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

Reduce conversion of Symbol to String #642

Closed
wants to merge 6 commits into from

Conversation

ashmaroli
Copy link
Contributor

Instead of interpolating :rouge (default and therefore more common scenario) to "rouge" multiple times when a Kramdown::Document is converted to_html, use a frozen_string to be used per instance.

Copy link
Owner

@gettalong gettalong left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution!

If you can adapt your pull request as per my comments, I will merge it.

lib/kramdown/converter/html.rb Outdated Show resolved Hide resolved
lib/kramdown/converter/html.rb Outdated Show resolved Hide resolved
@gettalong
Copy link
Owner

Perfect, thank you! I have squash-merged your changes and additionally, since the new @highlighter instance variable is only used in one place where it gets interpolated into a string, I have changed the instance variable to do the interpolation only once, saving additional string operations.

@gettalong gettalong closed this Apr 17, 2020
@ashmaroli
Copy link
Contributor Author

have changed the instance variable to do the interpolation only once

That's even better!! ✨

@ashmaroli ashmaroli deleted the interpolate-string branch April 17, 2020 16:32
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