Questions tagged [highlight.js]
Highlight.js highlights syntax in code examples on blogs, forums and in fact on any web pages.
highlight.js
166
questions
0
votes
0
answers
19
views
How to make markdown.js find the explicit language from a code block rendered from GFM
I am processing a markdown code block using GFM, and it's rendering like so:
<div class="language-powershell">
<div class="highlight">
<pre class="...
1
vote
1
answer
24
views
Highlight.js: Can't get the styling added to my webpage
I'm trying to get a styled block of code on my website. Highlight.js seems to be what I'm looking for. However when I run my website it doesn't show the layout.
What I've done so far:
1 install it by ...
0
votes
0
answers
19
views
Does PrimeReact's Editor support highlight.js?
I'm using PrimeReact's Editor component and trying to add syntax highlighting to it. It is based on the Quill library so I tried to use highlight.js lib as the Quill's documentation says:
import hljs ...
1
vote
1
answer
73
views
Dynamically Change Highlight.js Theme with Button Toggle (Light/Dark Mode)
I'm using the highlight.js library to display code snippets on my webpage. I'd like to add a button that allows users to switch between light and dark themes for the code snippets. Ideally, clicking ...
1
vote
0
answers
28
views
Use css whitespace in pre code syntaxhighlight version 11
According to official documentation, syntaxhightlight version 11 remove useBR configuration.
It recommend to use plugin or simply css white-space:pre
I can do it with plugin like this.
<!...
1
vote
1
answer
57
views
How can I render PRE-formatted content using a-h/templ in Go?
I want to utilise highlight.js in a a-h/templ template, but I can't get the pre block to format correctly.
The goal is to have:
<pre>
<code class="language-go">
var User ...
0
votes
1
answer
31
views
Rendering an escaped string with lit element?
This demo first highlights html contained inside the fs-highlight element and assigns the result to the _code property.
The render method then renders the template with the _code highlighted html ...
1
vote
0
answers
33
views
How to reference highlighter.js within lit element?
How do we use highlight.js inside a lit element web component if we are importing highlight.js in a index.html file.
So for example in the head element of index.html we may have this:
<link
...
0
votes
0
answers
82
views
How to use marked-highlight from a VSCode extension?
If I use the example code from here in a standalone TypeScript file, then it works fine.
import { Marked } from "marked";
import { markedHighlight } from "marked-highlight";
import ...
0
votes
0
answers
51
views
HTML written with Quill and Highlight.js in Next.js is not rendered properly
const QuillEditor = dynamic(
async () => {
hljs.configure({
languages: ['javascript', 'typescript', 'html', 'python']
})
// @ts-ignore
window.hljs = ...
0
votes
1
answer
22
views
On highlight an external file page load seems to fail
Trying to highlight an external file main.cpp with highlight.js I put together the following:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
href=&...
0
votes
1
answer
51
views
highlight.js disappearing html meta tags
I have used highlight.js successfully in other places.
but I can't get it to work now.
Code disappears.
hljs.highlightAll()
<pre><code class="language-html">
<!-- android - change ...
1
vote
0
answers
200
views
Highlight markdown code in textarea (VueJS)
I would like to have 1 textarea with markdown syntax highlighting. I am currently using highlight.js. I wrote a proof of concept, however, this provides me with an additional text area. I would like ...
0
votes
0
answers
147
views
I have some problem in @react-pdf-viewer/highlight in React jsx
I'm new here.
I can view PDF file on my website, but I can't highlight keywords in PDF and I don't figure out what problem is.
import { Worker, Viewer } from '@react-pdf-viewer/core';
import { pdfjs }...
0
votes
1
answer
280
views
How to convert OpenAPI response example content to simple JSON ready for code highlighter?
I want to display example content of a response in paths.{url}.{method}.responses section of OpenAPI v3.0.0 specs in highlight.js. I am currently getting such object from a remote JSON OpenAPI spec:
&...