Highlight.JS Inline Code Syntax Highlightning
See original GitHub issueHighlight.js is a great highlightning tool. But now i want to know if it is also possible to make inline highlighting, so not like a block (like at http://tekkkz.com/posts/articles/arch_installation.html) but inside a text paragraph?
If it is possible, how?
The answer, for version 11 and up.
If using version 11 or newer of highlight.js you can use the following to also highlight <code>
elements.
hljs.config({ cssSelector: 'code' });;
hljs.highlightAll();
Otherwise, check our README (this can be done with just a few lines of code) or skim below for possibly more specific examples.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:16 (11 by maintainers)
Top Results From Across the Web
highlight.js inline mode possible? - Stack Overflow
Since your inline markup is in a <span> tag, that is, the hierarchy is span code , you can achieve inline highlighting with...
Read more >How to use highlight.js
You can run highlighting inside a web worker to avoid freezing the browser window while dealing with very big chunks of code. In...
Read more >Syntax Highlight Guide | Visual Studio Code Extension API
Syntax highlighting determines the color and style of source code displayed in the Visual Studio Code editor. It is responsible for colorizing keywords...
Read more >Upgrading to Highlight.js v11.0
github includes significant changes to more properly match modern GitHub syntax highlighting. If you desire the old theme you can manually copy it...
Read more >Is Inline Code Syntax Highlighting Possible - R Markdown
shell is a supported class in highlight.js but not by pandoc's highlighter. Also, since I'm using blogdown, it uses highlight.js by default. How ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Problem is:
The code won’t be displayed as inline.
Solution is to add the following to your css code:
Sounds like a Prismatic problem, maybe. I feel users should actually know and understand their setup and how they are altering it. Far too much harm comes from from people copying and pasting code they don’t understand from one box to another. Perhaps you’ve never been “that user” yet though. 😃