棱镜代码渲染和JSX Markdown在静态HTML页面上不起作用
我一直在尝试在静态HTML页面上实施棱镜,以显示基本技能投资组合网站的代码块。我已经将Prism进口到脚本标签和CSS链接标签中的页面上的相关位置。我还完成了所需的
<pre>
<code class="language-jsx">
</code>
</pre>
浏览器,我得到了呈现的代码块的米色背景,并且JS被高光照射,因为Prism应该这样做。
但是,浏览器将将代码返回的JSX Markdown作为HTML。我已经看到了Prism网站的一部分,该网站讨论了HTML的渲染,并且我确实认为JSX实际上是HTML Markup,但我认为Prism是解决这个问题的一种方式。
const SomeReactComponent = (props) => {
return(
<ThisWontRender />
)
}
我要避免的是必须与&amp; lt;
我错过了什么吗?
I have been trying to implement prism on a static HTML page to show code blocks for a basic skills portfolio site. I have imported Prism into the relevant places on the page in a script tag and in a CSS link tag. I also did the required
<pre>
<code class="language-jsx">
</code>
</pre>
In the browser I'm getting the beige background of the code block rendered and the js is being high-lighted as Prism is supposed to do.
However the jsx markdown that is to be returned by the code is being taken as HTML by the browser. I have seen the part of the Prism website that discusses the rendering of HTML and I do get that jsx is in reality HTML markup but I would have thought that Prism is a way round this issue.
const SomeReactComponent = (props) => {
return(
<ThisWontRender />
)
}
What I'm trying to avoid is having to escape the HTML with & lt;
Have I missed something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论