JetBrains / markdown

Markdown parser written in kotlin
Apache License 2.0
682 stars 75 forks source link

Put code fence indents into separate whitespace nodes instead of fence content #112

Open FirstTimeInForever opened 1 year ago

FirstTimeInForever commented 1 year ago

Currently, indented code fences are incorrectly represented in the AST. Currently, the actual indents are being put into the CODE_FENCE_CONTENT nodes, which makes language injections much harder, since you need to manually calculate indents for each fence line. This PR solves this problem by calculating indents during parsing and putting them into separate WHITE_SPACE nodes, so they won't pollute actual content nodes.