Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
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
generate: demote headings, and group link reference definitions #620
generate: demote headings, and group link reference definitions #620
Changes from 5 commits
a098a9c
8e4bc8a
b62775e
5284615
cb47886
2f65060
118fd27
da1d695
3a514c2
d7cea65
ff23522
dc291af
42a8d14
d1a1ab1
394221c
3b0afc2
0d88452
94878f0
42b1460
5d333b8
09f4fca
c244d1a
1ecc512
607f369
4ee45ef
7727f73
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heading could also be in a comment block I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. In 5284615 I mentioned that it doesn't support HTML blocks, and there are a lot of them beside comment blocks.
However, in Exercism's markdown spec we write:
So do we want to support the below anyway?
And if we add
markdownlint
to every track, would we enableMD033
? If "yes" to the latter, then we probably don't need to avoid demoting#
inside HTML blocks in this PR.The markdown handling in this PR is very naive, but doing it robustly requires a full markdown parser. And sadly, it doesn't seem like there's a mature, robust, and pure-Nim markdown parser that allows:
It looks like the best option is to use the wrapper for libcmark, but that will make it more complicated to keep configlet as a dependency-free binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be more specific, it looks like soasme/nim-markdown at best only supports
The best I could do was along the lines of:
There are also performance killers like
token.children.toSeq.map((t: Token) => $t).join("\n")
everywhere in the critical path.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't worry much about performance, as it is likely in the range of milliseconds? But the fact that you can't go back to markdown is quite annoying.
I think most editors would use that comment format by default. But maybe nobody actually uses headings in comments? 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant more like "this is code smell to me". It'd push me further towards "just use libcmark", even if
soasme/nim-markdown
supported markdown -> AST -> markdown.Mmm. Probably true.
Supporting
<!-- -->
with the approach in this PR isn't much work. But do we want to support a line beginning with#
inside any others from https://spec.commonmark.org/0.30/#html-blocks?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed da1d695 to add support for HTML comment blocks