Replies: 1 comment 1 reply
-
No, the option for partial highlight does not exist. The code gets split to tokens to add styles to it. <span>function</span> <span>foo</span><span>(</span><span>bar</span><span>) {</span>
<span>console</span><span>.</span><span>log</span><span>(</span><span>bar</span><span>)
}</span> If you want to highlight parts of the code, it might work for some words, e.g. In conclusion, I think that it's hard to make this work as expected, Example for a real with shiki styled codeInput: export default defineNitroPlugin((nitroApp) => {
// ...
}) Output: <pre>
<code>
<span class="line" line="1">
<span class="ct-942366">export</span><span class="ct-443230"> </span><span class="ct-942366">default</span><span class="ct-443230"> </span><span class="ct-923966">defineNitroPlugin</span><span class="ct-443230">((nitroApp) </span><span class="ct-942366">=></span><span class="ct-443230"> </span><span class="ct-935781">{</span>
</span>
<span class="line" line="2">
<span class="ct-935781"> </span><span class="ct-128513">// ...</span>
</span>
<span class="line" line="3">
<span class="ct-935781">}</span><span class="ct-443230">)</span>
</span>
</code>
</pre> |
Beta Was this translation helpful? Give feedback.
-
Is there any way to highlight the function parameter
bar
in the code block?If there is not I think it would be useful to have the ability to do something like this
Beta Was this translation helpful? Give feedback.
All reactions