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

Add support for kramdown options #1543

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dometto
Copy link
Contributor

@dometto dometto commented May 16, 2022

For commonmarker, it is already possible to pass in parsing and rendering options in the GitHub::Markup.render call, e.g.:

GitHub::Markup.render("test.md", "hello <bad> world", options: {commonmarker_opts: [:UNSAFE]})

This PR adds support for the same feature for the kramdown implementation, allowing e.g.:

GitHub::Markup.render("# Test\n", options: {:kramdown_opts => { :auto_ids=>false}})

I've also added tests, which necessitated requiring kramdown on both the JRuby and MRI platforms (instead of just JRuby). If this is undesirable, the tests could also be left out by reverting the last commit from this PR.

@dometto
Copy link
Contributor Author

dometto commented Aug 11, 2022

@aharpole any chance this could be merged?

@@ -22,7 +22,8 @@ class Markdown < Implementation
Maruku.new(content).to_html
},
"kramdown" => proc { |content, options: {}|
Kramdown::Document.new(content).to_html
puts options.inspect
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you remove this? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry! Done.

@dometto
Copy link
Contributor Author

dometto commented Aug 14, 2022

The test failure is unrelated. The cgi gem is apparently calling String#delete_prefix, which doesn't exist on ruby 2.4.1. May be related to 2.4's general oldness and this warning: Your RubyGems version (2.6.14.4) has a bug that prevents "required_ruby_version" from working for Bundler.

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.

None yet

2 participants