Markdown parser: Fix bug with --- yaml separator in code blocks#2313
Conversation
|
This should be fixable without a negative lookbehind, which I try and avoid due to performance and correctness issues. Are setex headers really allowed to have newlines in them? |
|
@jneen Setex headers shouldn't have newlines, that comment is just showing how I can throw in a newline and Rouge no longer treats it like a header. Basically, I'm trying to tell it to treat "Text + newline + Or phrased differently, setex headers are never preceded by newlines or triple backtick lines. I'll tinker locally and see if I can figure something else out 🤔 Edit: Update, I might have figured it out! If you move the heading checks to be after the backtick check, that seems to do it. I've updated the PR and also came up with a simpler example to demonstrate it (the old one still works too). |
92e1921 to
94bcf22
Compare
It could be seen as a setex header if there is an --- immediately after the triple backticks. So handle the codeblock backticks first, and the setex header check afterwards
94bcf22 to
251a2c9
Compare
|
Looks great, thank you! |
When I put a
---as the first line in a codeblock, it seems to get parsed as a setex header by accident. For example, this should work fine:Solution
All we need to do is parse the backticks first, and move the setex header check to be after the backticks check.
Screenshots