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

Node#to_html with plugins does not work. #293

Closed
wakairo opened this issue May 12, 2024 · 1 comment · Fixed by #299
Closed

Node#to_html with plugins does not work. #293

wakairo opened this issue May 12, 2024 · 1 comment · Fixed by #299
Labels

Comments

@wakairo
Copy link

wakairo commented May 12, 2024

I tested the following code and it seems that the keyword argument "plugins" of Node#to_html does not make an effect on the version 1.1.2.

require 'commonmarker'

puts Commonmarker::VERSION # => 1.1.2

code = <<~CODE
  ```ruby
  puts "hello"
  ```
CODE
plugins = { syntax_highlighter: { theme: "InspiredGitHub" } }

p Commonmarker.to_html(code, plugins: plugins)
# => "<pre lang=\"ruby\" style=\"background-color:#ffffff;\"><code><span style=\"color:#62a35c;\">puts </span><span style=\"color:#183691;\">&quot;hello&quot;\n</span></code></pre>\n"

doc = Commonmarker.parse(code)
p doc.to_html(plugins: plugins)
# => "<pre lang=\"ruby\"><code>puts &quot;hello&quot;\n</code></pre>\n"
p doc.to_html
# => "<pre lang=\"ruby\"><code>puts &quot;hello&quot;\n</code></pre>\n"
@gjtorikian
Copy link
Owner

Thank you for the report! I haven't had time to look into this but I will soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants