You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why we want to solve this issue first:
How we solve this issue here can influence how we solve the rest issues for BlockQuotes, and more importantly, the parse of nested list.
What causes the problem:
Inspired by GitHub Flavored Markdown Spec, elm-markdown tries to have two separate parsing phases: first, we parse all blocks to build a tree of blocks, then, we parse all inlines which have been assigned to these blocks.
But at the current stage, we are back and forth between the two parsing phases: we parse all RawBlocks to build a list of RawBlocks where children of Block containers (who can hold blocks) haven’t parsed, and we parse the children in the inline parsing phase by entering the first RawBlocks parsing phase recursively. See here https://github.com/dillonkearns/elm-markdown/blob/a72ce4907bfc49e62d38546ce8829aa116af9a52/src/Markdown/Parser.elm#L296L305
So, when we parse the link references in inlines, we probably haven’t parsing their link reference definitions which are inside later RawBlocks. We can’t find the definitions outside the current container or insider the child container because the dict of reference definitions is separated in each run of rawBlockParser:
Possible solutions (of course not all):
Improve link references parser to ignore block container markers and use this parser for the attached string of BlockQuotes when the first parse phase end. In this way, the parser struct won’t change and the change of code is minor.
Cancel recursive call. Canceling recursive call might be good for the markdown parser. But this way will bring a lot changes.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Here we want to find a way to solve the issue: #60
Why we want to solve this issue first:
How we solve this issue here can influence how we solve the rest issues for BlockQuotes, and more importantly, the parse of nested list.
What causes the problem:
Inspired by GitHub Flavored Markdown Spec,
elm-markdown
tries to have two separate parsing phases: first, we parse all blocks to build a tree of blocks, then, we parse all inlines which have been assigned to these blocks.But at the current stage, we are back and forth between the two parsing phases: we parse all RawBlocks to build a list of RawBlocks where children of Block containers (who can hold blocks) haven’t parsed, and we parse the children in the inline parsing phase by entering the first RawBlocks parsing phase recursively. See here https://github.com/dillonkearns/elm-markdown/blob/a72ce4907bfc49e62d38546ce8829aa116af9a52/src/Markdown/Parser.elm#L296L305
So, when we parse the link references in inlines, we probably haven’t parsing their link reference definitions which are inside later RawBlocks. We can’t find the definitions outside the current container or insider the child container because the dict of reference definitions is separated in each run of rawBlockParser:
Possible solutions (of course not all):
......
Beta Was this translation helpful? Give feedback.
All reactions