-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Class for nested languages correct? #56
Comments
where, how? |
Example “HTML, XML” at https://highlightjs.org/examples – search for “language-javascript”: <pre class="theme-atom-one-dark shadow-3xl text-sm relative overflow-hidden max-w-full h-[400px] mb-6"><span class="hljs mb-0 p-4 block min-h-full overflow-auto"><code><span class="hljs-meta"><!DOCTYPE <span class="hljs-keyword">html</span>></span>
<span class="hljs-tag"><<span class="hljs-name">title</span>></span>Title<span class="hljs-tag"></<span class="hljs-name">title</span>></span>
<span class="hljs-tag"><<span class="hljs-name">style</span>></span><span class="language-css"><span class="hljs-selector-tag">body</span> {<span class="hljs-attribute">width</span>: <span class="hljs-number">500px</span>;}</span><span class="hljs-tag"></<span class="hljs-name">style</span>></span>
<span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"application/javascript"</span>></span><span class="language-javascript">
<span class="hljs-keyword">function</span> <span class="hljs-title function_">$init</span>(<span class="hljs-params"></span>) {<span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;}
</span><span class="hljs-tag"></<span class="hljs-name">script</span>></span>
<span class="hljs-tag"><<span class="hljs-name">body</span>></span>
<span class="hljs-tag"><<span class="hljs-name">p</span> <span class="hljs-attr">checked</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"title"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">'title'</span>></span>Title<span class="hljs-tag"></<span class="hljs-name">p</span>></span>
<span class="hljs-comment"><!-- here goes the rest of the page --></span>
<span class="hljs-tag"></<span class="hljs-name">body</span>></span></code></span><small class="bg-black/30 absolute top-0 right-0 uppercase font-bold text-xs rounded-bl-md px-2 py-1"><span class="sr-only">Language:</span>HTML, XML</small></pre> |
Right that’s highlightjs but how are you using lowlight and where are you getting Can you post actual input and actual output and expected output? |
const sourceCodeHtml = outdent`
<!DOCTYPE html>
<title>Title</title>
<style>body {width: 500px;}</style>
<script>
function $init() {return true;}
</script>
<body>
<p checked class="title" id='title'>Title</p>
<!-- here goes the rest of the page -->
</body>
`;
function logHastTree() {
const lowlight = createLowlight(common);
const tree = lowlight.highlight('html', sourceCodeHtml);
console.dir(tree, { depth: undefined });
} Nested inside the output:
It’s not a problem for me but I thought that you might want to know about the difference. |
I dunno. Maybe related to Lines 449 to 454 in c5dc24b
language- .
|
oh, might be Line 433 in c5dc24b
|
Right! It has to be about |
I don’t really have opinions about what value is “correct”; a prefix might be nice; matching hljs is probably nice too. |
I’m getting (e.g.):
But Highlight.js uses
language-javascript
The text was updated successfully, but these errors were encountered: