-
Notifications
You must be signed in to change notification settings - Fork 31
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
Fix separators in blocks #403
Conversation
@lostenderman: On the first glance, this seems to be an issue with trailing newlines, i.e. one of the templates ends the input with a trailing newline whereas the other does not. This should make no difference to the parser. |
Using the Docker image built by the CI for commit 0ae98fc from this PR, I checked that this is not an issue with trailing newlines: $ docker run --rm -it 'ghcr.io/witiko/markdown:0ae98fc2-latest-no_docs'
$ markdown-cli <<< $'>\n> *foo*\n> ' # Parse text from `testfiles/CommonMark_0.30/block_quotes/014.test`.
\markdownRendererDocumentBegin
\markdownRendererBlockQuoteBegin
\markdownRendererEmphasis{foo}
\markdownRendererBlockQuoteEnd \markdownRendererDocumentEnd
$ markdown-cli <<< $'>\n> *foo*\n> \n' # Add a trailing newline.
\markdownRendererDocumentBegin
\markdownRendererBlockQuoteBegin
\markdownRendererEmphasis{foo}
\markdownRendererBlockQuoteEnd \markdownRendererDocumentEnd
$ markdown-cli <<< $'>\n> *foo*\n> \n\n' # Add another trailing newline.
\markdownRendererDocumentBegin
\markdownRendererBlockQuoteBegin
\markdownRendererEmphasis{foo}
\markdownRendererBlockQuoteEnd \markdownRendererDocumentEnd Instead, the issue seems to be with the way ConTeXt handles trailing spaces at the end of a line in verbatim input. In most TeX engines, the trailing spaces are removed when TeX reads input. Therefore, users cannot type hard line breaks using trailing spaces. This is a known shortcoming of using verbatim input to type markdown. In ConTeXt, trailing spaces are replaced by a pair of tabs, so that TeX does not remove them: Lines 35290 to 35324 in 822abcc
By replacing the trailing spaces in the last line of the markdown text from $ docker run --rm -it 'ghcr.io/witiko/markdown:0ae98fc2-latest-no_docs'
$ markdown-cli <<< $'>\n> *foo*\n> ' # Parse text from `testfiles/CommonMark_0.30/block_quotes/014.test`.
\markdownRendererDocumentBegin
\markdownRendererBlockQuoteBegin
\markdownRendererEmphasis{foo}
\markdownRendererBlockQuoteEnd \markdownRendererDocumentEnd
$ markdown-cli <<< $'>\n> *foo*\n>\t\t' # Replace trailing spaces with two tabs.
\markdownRendererDocumentBegin
\markdownRendererBlockQuoteBegin
\markdownRendererEmphasis{foo}
\markdownRendererBlockQuoteEnd \markdownRendererInterblockSeparator
{}\markdownRendererBlockQuoteBegin
\markdownRendererBlockQuoteEnd \markdownRendererDocumentEnd Can you please update the parser, so that the tabs make no difference? I understand that this is a corner case but we want the parser to be at least somewhat resilient to fuzzy input (in the absence of proper fuzz-testing). |
As discussed in <#403 (comment)>.
Closes #376.
Follows #377.