Repository navigation
Keep partially consumed tab when an HTML block starts or continues in a block quote - #462
Open
Shaisolaris wants to merge 1 commit into
Open
Shaisolaris wants to merge 1 commit into
Shaisolaris wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a tab after
>is only partly used up by the block quote marker, the rest of the tab is supposed to become spaces in the content, as it already does for paragraphs and indented code. For HTML blocks it is lost and the raw tab ends up in the output:>\t<div><blockquote>\n\t<div>\n</blockquote>\n<blockquote>\n <div>\n</blockquote>\n> <div>\n>\tfoo...<div>\n\tfoo\n......<div>\n foo\n...HtmlBlockParserstarts and continues withatIndex(state.getIndex()), meaning "stay where we are".DocumentParser.setNewIndex()always clearscolumnIsInTab, even when the index does not move, soaddLine()no longer expands the remaining tab columns. The fix returns early fromsetNewIndex()when the new index equals the current one, which leaves the partial tab state alone.Tests: two cases in
SpecialInputTest, with expected output taken from cmark (cmarkgfm, unsafe mode) and commonmark.js 0.31, which agree. They fail on main and pass with the change.mvn testacross all modules passes (1959 tests, including the spec tests), andspotless:checkis clean.I found this by comparing commonmark-java with commonmark.js on random inputs. Two other differences turned up that I have not touched here: trailing blank lines at the end of an unclosed HTML comment block, and info strings containing a tab.