gjtorikian / commonmarker

Ruby wrapper for the comrak (CommonMark parser) Rust crate
MIT License
416 stars 80 forks source link

Node#to_html with plugins does not work. #293

Closed wakairo closed 3 weeks ago

wakairo commented 1 month ago

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;\"><span style=\"color:#62a35c;\">puts <span style=\"color:#183691;\">"hello"\n\n"

doc = Commonmarker.parse(code) p doc.to_html(plugins: plugins)

=> "<pre lang=\"ruby\">puts "hello"\n\n"

p doc.to_html

=> "<pre lang=\"ruby\">puts "hello"\n\n"

gjtorikian commented 1 month ago

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