Skip to content
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

cpp extend clike #1914

Closed
wants to merge 1 commit into from
Closed

cpp extend clike #1914

wants to merge 1 commit into from

Conversation

straicat
Copy link

Fix: prism-cpp load failed.

If cpp extend c, it will fallback to default language.

@straicat
Copy link
Author

const md = require('markdown-it')();
const prism = require('markdown-it-prism');
md.use(prism);
const markdown = "```cpp\n" +
                "class Demo { };\n"+
                "```";
const ret = md.render(markdown);
console.log(ret);

markdown-it-prism will use prism as backend to render codeblocks. However, if cpp extend c, it will fail to load prism-cpp.js, and it render the markdown text as follow:

<pre class="language-cpp"><code class="language-cpp">class Demo { };
</code></pre>

While if cpp extend clike, it is:

<pre class="language-cpp"><code class="language-cpp"><span class="token keyword">class</span> <span class="token class-name">Demo</span> <span class="token punctuation">{</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>

Maybe there is some mistakes in it.

@RunDevelopment
Copy link
Member

This issue is caused by markdown-it-prism, not PrismJS. See the issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants