-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Related to #1238. Using Prism v1.14.0.
I'm trying to highlight PHP code which has HTML in it. More specifically, this is what I am trying to highlight.
<link rel="stylesheet" href="<?php echo $this->getStaticUrl('css/styles.css'); ?>">I included the PHP component and its dependencies and executed Prism.highlight(). However, the result I'm getting is similar to C-like syntax.
From the Test Drive page, PHP should be working correctly so I have no clue what I'm doing wrong. I'm trying to look for instructions to set it up correctly but I see none so I assume it should be simple.
Here's the code:
import Prism from "prismjs";
import "prismjs/components/prism-markup-templating.js";
import "prismjs/components/prism-php.js";
const hl = Prism.highlight(snippet, Prism.languages["php"]);
// Output hl to DOMThe parsed HTML is as follows:
<span class="token operator"><</span>
link rel
<span class="token operator">=</span>
<span class="token double-quoted-string string">"stylesheet"</span>
href
<span class="token operator">=</span>
<span class="token double-quoted-string string">"<?php echo
<span class="token interpolation">
<span class="token variable">$this</span>
<span class="token operator">-</span>
<span class="token operator">></span>
<span class="token property">getStaticUrl</span>
</span>
('css/styles.css'); ?>"
</span>
<span class="token operator">></span>Metadata
Metadata
Assignees
Labels
No labels
