Skip to content

Weird interaction of code block with other block parsers #1008

Answered by colinodell
dkarlovi asked this question in Q&A
Discussion options

You must be logged in to vote

It looks like the FigureParser is consuming all of the leading whitespace in the tryContinue() method:

https://github.com/JanStanleyWatt/commonmark-figure-extension/blob/1a1efd0f89197e90dcf87e58977cc064ed13e603/src/Parser/FigureParser.php#L64-L77

That method is called when the parser engine is checking to see whether that block continues onto the next line. In this case, FigureParser "consumes" all of that leading whitespace before the child code block even gets a chance to inspect that line.

Applying this change should fix things:

diff --git a/src/Parser/FigureParser.php b/src/Parser/FigureParser.php
index d512cb4..e9838c7 100644
--- a/src/Parser/FigureParser.php
+++ b/src/Parser/FigureP…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dkarlovi
Comment options

Answer selected by dkarlovi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question General questions about the project or usage
2 participants
Converted from issue

This discussion was converted from issue #1007 on January 09, 2024 13:09.