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

Can not parse well Markdown syntax in code block #659

Closed
YumaInaura opened this issue Aug 9, 2018 · 2 comments
Closed

Can not parse well Markdown syntax in code block #659

YumaInaura opened this issue Aug 9, 2018 · 2 comments

Comments

@YumaInaura
Copy link

YumaInaura commented Aug 9, 2018

example ruby script

require 'redcarpet/compat'

text = <<~TEXT
# Header1

```
# This line parsed as header, not as plain text
echo ok
echo ok
```
TEXT

puts Markdown.new(text).to_html

Outputs

<h1>Header1</h1>


<p>``````</p>

<h1>This line parsed as header, not as plain text</h1>

<p>echo ok
echo ok
```</p>

My verssions

  • redcarpet (3.4.0)
  • ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
@robin850
Copy link
Collaborator

Hello @YumaInaura,

Actually you need to enable the fenced_code_blocks option; this syntax is not supported by original Markdown, so you should rather write:

Markdown.new(text, :fenced_code_blocks).to_html

Thanks for spotting this anyway !

@YumaInaura
Copy link
Author

Thank you!!
So helpful navigation

@robin850

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

No branches or pull requests

2 participants