pngwn / MDsveX

A markdown preprocessor for Svelte.
https://mdsvex.pngwn.io
MIT License
2.36k stars 102 forks source link

Code blocks not working in REPL #65

Closed nathancahill closed 4 years ago

nathancahill commented 4 years ago

Here's a simple example with an HTML codeblock:

## Hello world

Hello world

This is parsed literally in 0.8, the back-tick fencing is ignored and a link is rendered.

pngwn commented 4 years ago

I can't reproduce this locally, I think this is a quirk of the REPL because of how I'm avoiding code auto-highlighting there. Code highlighting doesn't currently work in the REPL because it relies on some very node-specific code.

Is this a problem you noticed in the REPL or locally running a full version of mdsvex?

nathancahill commented 4 years ago

Hmm, after wiping node_modules and reinstalling it is working locally. Not in the REPL though. Updating title, you can ignore if the REPL isn't a big deal.

pngwn commented 4 years ago

I want to get code-highlighting working in the REPL at some point, I just need to customise how different language support is loaded in when it is running in the browser.

pngwn commented 4 years ago

Not certain why this is happening right now. The highlight code is removed from the browser build which is probably related.

I think this is happening because the default highlighter is switched on, which disables code escaping (as it is handled by the highlighter) but that code never reaches the highlighter and remains unescaped.

The solution is probably to enable code block escaping based on two conditions: either when there is no highlight function or when generating the browser build. This should rectify the issue if my assumption is correct.

Long term, I want to get code block auto-highlighting working in the REPL.

pngwn commented 4 years ago

This is now fixed. The REPL also now automatically highlights code blocks: https://mdsvex.com