169 questions
1
vote
1
answer
92
views
German Umlauts cause incorrect code rendering
I'm facing an issue with highlight.js. When I include code containing German text with umlauts (e.g. "ö"), the code gets rendered incorrectly starting from the point where the umlaut appears....
1
vote
1
answer
54
views
Klipper Syntax Highlighter using Highlight.JS
I'm trying to create a syntax highlighter for the Klipper 3D printer firmware. The language consists of settings elements, comments and Jinja2 template elements. In the first place, I wanted to get a ...
-1
votes
1
answer
51
views
Highlight.js: Single line code block with scroll-x
I have set up Highlighterjs with my NextJS@13+ page routing, but the code block is taking single line with scroll-x. Look at the image...
If i remove the useEffect the highliger is gone, but the line ...
-2
votes
1
answer
51
views
Highlighting.js does not colour code but only wraps it in formatting markup
I use highlight.js in my Django project, and it doesn't work. It doesn't, highlight the code, but it wraps it with many span class tags.
My base.html:
<html lang="en" class="h-100&...
0
votes
1
answer
498
views
How can I get a transparent background, while still having Syntax Highlighting?
So basically, I'm trying to make the code block the same color as the background (In this case white), while still keeping the colors on the code.
What I've Tried
I've tried overriding the theme's CSS ...
0
votes
1
answer
192
views
Highlight.js how to unset after ajax call
I have a Jquery JS script that loads a modal window. In that modal window there is a pre code tag where i via ajax pulls in a script. I want to use Highlight.js to make the code more readable.
I have ...
1
vote
0
answers
196
views
Using rollup with typescript and highlight.js
I'm trying to use rollup to build a bundle containing highlight.js.
This is the starter project I'm using to build the bundle. If we clone it and run:
git clone [email protected]:fireflysemantics/fs-lit-...
1
vote
1
answer
308
views
Style Code with highlightJS inside a web component
I have a web component with a <pre><code>... section which I would like styled by an external stylesheet (highlightJS).
NOTE: My Web Component has a slot and the pre and code blocks are ...
1
vote
1
answer
120
views
highlight.js with deno fresh not applying style
I'm trying to syntax highlight some code with highlight.js used with deno / fresh. My failed attempts are with the current versions of deno/fresh/highlight.js at august 7, 2024.
I'm working on Windows ...
1
vote
1
answer
168
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 ...
1
vote
0
answers
609
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
40
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
235
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
157
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 ...
2
votes
0
answers
91
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
1
answer
33
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
73
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
399
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
1
answer
701
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:
&...
2
votes
0
answers
309
views
Highlight.js removing line breaks from core/code block after update
I am running highlight.js in the WordPress block editor and set highlight.js to run when core/code block is updated. The core/code block natively uses <br data-rich-text-line-break="true"&...
2
votes
1
answer
553
views
Highlight.js not working with marked - returning TypeError: (e || "").toLowerCase is not a function
I'm using (client/browser side, not in Node):
Marked 9: <script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/marked.umd.min.js"></script>
Highlight.js 11: <script src=&...
3
votes
2
answers
2k
views
How to create highlightjs plugin on nuxt3
I try to create a plugin in nuxt3 that uses highligh.js and use it on my components. But I can't do it
I make this :
// @/plugins/highlight.js
import 'highlight.js/styles/stackoverflow-light.css'
...
0
votes
1
answer
189
views
Vuejs3 HighlightJS not showing syntax
Using the below code, I am getting the raw html instead and not formatted syntax.
what am I missing?
<script setup>
import hljs from 'highlight.js/lib/core';
import sql from 'highlight.js/lib/...
0
votes
1
answer
75
views
Pug cannot find installed Highlight.js JSTransformer filter
The documentation says I just have to install the filters via npm in order to use them.
If you want to be able to use filters in your Pug template, you would first make sure that these features are ...
0
votes
2
answers
276
views
How can I syntax hightlight SASS with Javascript?
I would like to syntax highlight my SASS code with highlight.js NPM package. However, I cannot get it to work.
SASS is not syntax highlighted, and the console displays this warning:
a
text-...
1
vote
1
answer
655
views
markdown generated html is not styled by the styles specified by css
Good day,
I am trying to create a markdown previewer using Svelte. I'm using the following libraries for different tasks:
Marked library for parsing markdown,
Highlight.js for highlighting code ...
0
votes
1
answer
1k
views
Highlight.js unable to syntax highlight content within nested html pages
I tried to use highlight.js to apply syntax highlighting to dynamic content. The dynamic content is an .html file that is read from a server and is embedded on the current page, and within this .html ...
0
votes
1
answer
48
views
in highlight js the long line of code comes out of the page
i use highlight js in my website for code
if i have a long line of code it comes out of the page and And the appearance of the page is ruined
for example:
this is a broken page of my site: https://...
1
vote
0
answers
1k
views
Automatic syntax highlighting of entire Quill body without code-block/<pre>
I have a React app in which there are a couple areas where users need to edit rich text bodies that can include merge field tokens in certain formats.
(There are two: one is the <<[ ]>> ...
0
votes
1
answer
120
views
ckeditor4 codesnippet plugin - dialogue is not showing
I installed the codesnippet plugin by copying the files in the plugins folder
I added codesnippet to the extra plugins line in include.php:
$ckeditor->config['extraPlugins'] = 'codesnippet,droplets,...
1
vote
2
answers
808
views
Error: Failed to resolve module specifier "highlight.js" in ES6 module compiled from TS
I am trying to use the library highlight.js for code highlighting, and it does come with support for ES modules. When I try to use it in a ES6 module compiled from TS, it comes back with the error: ...
0
votes
1
answer
221
views
Highlight file contents fetched from GitHub
I cannot get syntax highlighting to work for code fetched from GitHub.
fetch("https://raw.githubusercontent.com/Ayanmullick/test/master/AutomationAcc/test1.ps1")
.then(response => ...
-1
votes
1
answer
746
views
Vue3: How to use Highlight.js for Solidity code syntax?
I am building a webpage in Vue3. On this webpage I want to display some Solidity code and I would like it to be pretty and highlightend.
I found the Highlight.js (link) library. And I also found "...
1
vote
0
answers
581
views
How to use highlight.js in a VueJS app with mixed content
I'm currently using highlight.js to hightlight the code in the HTML content being received from my backend. An example of something I might receive from the backend is:
<h3> Check this example ...
0
votes
2
answers
2k
views
dynamically highlight block with highlight.js in vue app
I have a VueJS where I have created a component for rendering the contents from a WYSIWYG component (tiptap).
I have the following content being returned from the backend
let x = 0;
enum A {}
...
1
vote
1
answer
3k
views
Highlight.js with React.js syntax highlighting not working
I am trying to use highlight.js with react but the syntax highlighting is now working.
I am trying to store the highlighted syntax inside a variable but the whole content is displayed without ...
1
vote
0
answers
106
views
Gitlab syntax highlighting fails although language is supported
Gitlab uses highlight.js which supports the Scilab language, but it does not work as it can be seen in source tree files or snippets:
https://gitlab.com/scilab/scilab/-/blob/6.1/scilab/modules/cacsd/...
0
votes
0
answers
126
views
How to highlight syntax while on offline status?
I'm trying to make local code editor github-dark theme based with highlight.js library. But when importing from local file (literally copied source code on https://unpkg.com/[email protected]/min....
1
vote
2
answers
2k
views
highlight.js with highlightjs-line-numbers changes code font
I have a Jekyll blog, where I changed the code highlighter from Rouge (the default) to highlight.js, and it works perfectly.
However, I also want line numbers on my code snippets. Since highlight.js ...
1
vote
0
answers
448
views
How to dynamically change theme in highlight.js in a nuxt app with import command?
I know that there is another question with this topic, but it does not use import syntax and nuxt-js. In my nuxt app, I have four themes that the user could change them with a button on navigation. ...
0
votes
1
answer
142
views
How do I call a javscript function when content is edited in an HTML page?
I have a website that I am making that uses the highlight.js script. It's basically a syntax highlighting javascript code that highlights all <code> blocks. I have a <code contenteditable> ...
12
votes
0
answers
11k
views
How to highlight HTTP requests in Github Markdown?
I'm writing my README.md file for a Github repository, which contains some requisitions written for manual testing the application. The tool I use to make the manual tests is the REST Client extension ...
1
vote
2
answers
3k
views
Could not find the language 'cpp', did you forget to load/include a language module?
I want to use highlight.js in my website.But it doesn't work.
I use unpkg CDN and I import it like that:
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/[email protected]/...
0
votes
1
answer
322
views
Wierd font change when adding highlightjs to Hugo website using blowdown and Anatole theme
I am trying to add highlight.js to my Hugo website with Anatole theme.
This is how a code chunk looks like before adding highlightjs:
And this is how it looks like after adding highlight.js:
This is ...
7
votes
0
answers
3k
views
Highlight.js "Could not find the language 'undefined', did you forget to load/include a language module?"
I am using highlight.js for Froala editor code blocks at React. But I'm getting en error. I used registerLanguage function but it didn't work.
Error in browser:
Here is my code :
import ...
2
votes
2
answers
4k
views
Markdown code block highlight consistency - what is "s" alias
The built-in markdown editor has a "live-preview" for code blocks without open a side previewer.
I was looking for a list of supported language highlight, which as I understand is defined by ...
7
votes
2
answers
3k
views
How to install Highlight.js to Rails 7 with importmap?
I created a simple Rails 7 application with Post, Comment models using Tailwindcss.
And I have a problem with importing the highlight.js library to render syntax code in Trix editor.
This is config/...
1
vote
1
answer
2k
views
How to add more language in my Highlight.js
Based on the code sample, how to add new language like c#, php, java, sql, etc. This sample was provided by a man who answered my question last month. I tried to add new languages but not working. ...
-1
votes
3
answers
1k
views
How to print html code tags in a specific element?
<div class="container">
<pre>
<code class="language-html">
<h1>I want to display html tag</h1>
</code>
</...
2
votes
2
answers
2k
views
CSS not centering when changing width [duplicate]
I have the following code. It simply makes the python script formatted, with the colors using highlight.js.
hljs.highlightAll();
function clicked(){
if(document.getElementById("code")....