Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

[WIP] Add formatting based on lang for html_blocks #419

Closed
wants to merge 1 commit into from

Conversation

karanjthakkar
Copy link
Contributor

@revin The existing README highlighting for oojs: https://npm.im/oojs
The fixed highlighting after this change: https://auspicious-thread.surge.sh

Approach:

  1. Add a plugin which overrides the html_block renderer
  2. If a pre tag is available with, it checks if the lang is javascript/bash. (Couldnt find a more comprehensive list of supported langs but new ones can be added without issues)
  3. Extract content from the html block
  4. Replace token content with this
  5. calls the parent html_block renderer and then uses the code from https://github.com/npm/marky-markdown/blob/master/lib/plugin/code-wrap.js to wrap this generated html into a code highlighting wrapper

Overall this seems to fix the issue. I'd like to get your feedback on whether I solved it in the right way. Also, I'm a little confused as to how I should go about adding tests for this. Any help/advice would be appreciated.


Fixes #402

@karanjthakkar
Copy link
Contributor Author

Bump.

@karanjthakkar karanjthakkar deleted the html-block-format branch April 19, 2018 10:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support syntax highlighting in <pre>
1 participant