Custom syntax highlighter is never called
See original GitHub issueSteps to reproduce:
- Clone the Svelte template
- Install
mdsvex
:yarn add -D mdsvex
- Set up MDsveX in
rollup.config.js
:
// ...
import { mdsvex } from 'mdsvex';
export default {
// ...
plugins: [
// ...
svelte({
extensions: ['.svelte', '.svx'],
preprocess: mdsvex({
highlight(code, _lang) {
console.log('called');
return `<pre>${code}</pre>`;
}
}),
}),
// ...
- Add an MDsveX file (
src/test.svx
) with the following content:
```js
alert()
```
- Import the new file into
src/App.svelte
Expected
called
will be printed anywhere signifying that the highlighter was called
Actual
Nothing printed, the default highlighter is used
Also I’m wondering if there’s any simple way of stripping the initial newline that is rendered in the <pre>
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Custom syntax highlighting in vim for links
I have a plugin that I wrote called the ctags highlighter which does a fairly similar thing: it uses ctags to generate a...
Read more >jgnewman/custom-syntax-highlighter: Define your own ...
Custom -syntax-highlighter will loop over your code blocks and wrap the matches it finds with spans that have the class name. This way,...
Read more >Syntax Highlight Guide | Visual Studio Code Extension API
Syntax highlighting determines the color and style of source code displayed in the Visual Studio Code editor. It is responsible for colorizing keywords...
Read more >react-syntax-highlighter-custom
syntax highlighting component for react with prismjs or highlightjs ast using inline styles. Latest version: 15.5.0, last published: 2 years ...
Read more >Goodbye, Prettify. Hello highlight.js! Swapping out our ...
We are updating the client-side code block renderer that styles your code in posts (Questions, Answers, etc) and in the editor preview. Syntax...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like I didn’t update the docs. Highlight should be an object that accepts a
highlighter
property:I’ll update the documentation.
Can you give an example for the initial newline you mentioned?
Fixed in #110.
Thanks @TheComputerM!