We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As Extractly is used by Earmark and potentially by EarmarkParser parsing the markdown is not an option (and probably total overkill anyway).
Earmark
EarmarkParser
Therefore scanning for lines matching ~r{\A \s{0,3} (#{1,7}) \s+ (.*)}x shall deliver the necessary information.
~r{\A \s{0,3} (#{1,7}) \s+ (.*)}x
With that in mind such a list shall be obtained by the following pseudo code
lines |> Enum.map(&Regex.run(~r{\A \s{0,3} (#{1,7}) \s+ (.*)}x, &1) |> Enum.filter(& &1) |> Enum.map(fn [_, header, title] -> {String.length(header), title} end)
yielding, e.g. ...
[{1, "Main"}, {2, "Sub 1"}, {2, "Sub 2"}, {3, "SubSub"}, {1, "Epilogue"}]
which than, depending on some options shall yield markdown, e.g.
1. Main 1. Sub 1 1. Sub 2 1. SubSub 1. Epilogue
numbered: 1
nil
levels: 7
output: :markdown
:ast
:html
:json
Setext headers are not taken into account, as I do not have a use case for now
The text was updated successfully, but these errors were encountered:
13e7f85
RobertDober
No branches or pull requests
Synopsis
As Extractly is used by
Earmark
and potentially byEarmarkParser
parsing the markdown is not an option (and probably total overkill anyway).Therefore scanning for lines matching
~r{\A \s{0,3} (#{1,7}) \s+ (.*)}x
shall deliver the necessary information.Sketch
With that in mind such a list shall be obtained by the following pseudo code
yielding, e.g. ...
which than, depending on some options shall yield markdown, e.g.
Options
numbered: 1
value for starting position,nil
for unnumbered listslevels: 7
maximum level of headers taken into accountoutput: :markdown
alternatives like:ast
,:html
or:json
might be a nice enhancementLimitations
Setext headers are not taken into account, as I do not have a use case for now
The text was updated successfully, but these errors were encountered: