Skip to content

Match closing fence char and length in fenced code blocks - #681

Merged
mattr- merged 2 commits into
vmg:masterfrom
orchitech:match-closing-fence-type-and-length
Jul 1, 2021
Merged

Match closing fence char and length in fenced code blocks#681
mattr- merged 2 commits into
vmg:masterfrom
orchitech:match-closing-fence-type-and-length

Conversation

@martincizek

Copy link
Copy Markdown
Contributor

is_codefence() now allows fence-pair matching to comply with https://spec.commonmark.org/0.29/#fenced-code-block

closing code fence of the same type as the code block began with (backticks or tildes), and with at least as many backticks or tildes as the opening code fence

So the following now works (as it does in GitHub, otherwise it would be difficult to type this :-))

````
This is some code containing a fence string
```
protected by extending the enclosing fence
````

~~~
This is some code containing a fence string
```
protected by using the other fence type
~~~

Fixes #208.

@mattr-

mattr- commented Jul 1, 2021

Copy link
Copy Markdown
Collaborator

Apologies for taking so long to review this and merge it in. Thank you for contributing this feature to Redcarpet! ❤️

@mattr-
mattr- merged commit 03b664d into vmg:master Jul 1, 2021
@djuber

djuber commented Jul 9, 2021

Copy link
Copy Markdown

@mattr- thanks for merging this! Is there a gem version release expected soon that incorporates this? Would you like me to start a PR for that?

@mattr-

mattr- commented Aug 5, 2021

Copy link
Copy Markdown
Collaborator

We'll handle the gem version bump and release from here. No ETA on when that might be though. If you can use master for the time being, I recommend doing that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to escape code fences

3 participants