-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Ensure <pre> nodes are not removed after syntax highlighting #295
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ Rake::TestTask.new do |t| | |
t.libs << 'test' | ||
t.test_files = FileList['test/**/*_test.rb'] | ||
t.verbose = true | ||
t.warning = false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rouge is spitting out a ton of warnings which made the test output a bit annoying, so I added this flag. |
||
end | ||
|
||
task default: :test |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,10 @@ def call | |
html = highlight_with_timeout_handling(text, lang) | ||
next if html.nil? | ||
|
||
next unless (node = node.replace(html).first) | ||
node.inner_html = html | ||
klass = node['class'] | ||
klass = [klass, "highlight-#{lang}"].compact.join ' ' | ||
scope = context[:scope] || "highlight-#{lang}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to be able to scope my css, so I added this option. For more info, https://github.com/jneen/rouge#scope-highlight |
||
klass = [klass, scope].compact.join ' ' | ||
|
||
node['class'] = klass | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumped because
:GITHUB_PRE_LANG
was not introduced until 0.16.1