Skip to content
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

Improve handling of the fenced code blocks #36

Conversation

nolange
Copy link
Contributor

@nolange nolange commented Mar 29, 2023

Supports whitespace after the fence. ex:

``` plantuml
stuff
```

Support more than 3 ticks or tildes for code blocks, this is still only a part of the variations in the wilds [1]

Finds the correct matching ending fence by using identation, this required adding some more groups to the regexp and the option MULTILINE. ex.

    ```` plantuml
        stuff containing ```
    ````

[1] - https://pandoc.org/MANUAL.html#fenced-code-blocks

Closes: #34

@nolange nolange force-pushed the improve_fence_code_parsing branch from feb6cea to f1e8fdc Compare May 8, 2023 08:01
@b-bittner
Copy link
Contributor

@nolange first of all, thanks for your effort!

Because of the big changes in PR #46, could you please update your code to the newest baseline.

Supports whitespace after the fence. ex:

``` plantuml
stuff
```

Support more than 3 ticks or tildes for code blocks, this is still
only a part of the variations in the wilds [1]

Finds the correct matching ending fence by using identation,
this required adding some more groups to the regexp and
the option MULTILINE. ex.

    ```` plantuml
        stuff containing ```
    ````

[1] - https://pandoc.org/MANUAL.html#fenced-code-blocks

Closes: AVATEAM-IT-SYSTEMHAUS#34
Use a fixed regex to match all fence blocks, not just the
ones that are modified by this plugin.

de-indent the code block before processing.

This will avoid having wrong matches within a fenced block. ex:

````
Hey, this is just regular text, presenting a plantuml code block.

``` plantuml
@startuml
...
@enduml
```
````

De-indentind the code is necessary if the code block is in a structural
element like a list.
(Apart from being not correct, handling from_file_prefix did not work in
that case)
@nolange
Copy link
Contributor Author

nolange commented Jan 15, 2024

@b-bittner : All done and ready from my side

@nolange
Copy link
Contributor Author

nolange commented Mar 22, 2024

Ping?
Would like to get this merged, the current version doesn't work correctly with alot of valid Markdown files

@oniboni oniboni changed the base branch from main to 58-improve-handling-of-the-fenced-code-blocks May 17, 2024 12:37
@oniboni oniboni merged commit 233a3ef into AVATEAM-IT-SYSTEMHAUS:58-improve-handling-of-the-fenced-code-blocks May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

support whitespace after fenced block
3 participants