Prismjs高亮文件 [英] Prismjs highlight file

查看:126
本文介绍了Prismjs高亮文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Prismjs突出显示C ++文件 https://prismjs.com/index.html文件突出显示插件 https://prismjs.com/plugins/file-highlight/ .所以我尝试了:

I'm trying to highlight C++ file with Prismjs https://prismjs.com/index.html file highlight plugin https://prismjs.com/plugins/file-highlight/. So I tried:

<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
    <link href="themes/prism.css" rel="stylesheet" />
</head>
<body>
    <script src="prism.js"></script>
    <pre data-src="main.cpp"></pre>
    <pre><code class="language-css">p { color: red }</code></pre>
</body>
</html>

但是它不起作用.一块CSS出现在这里,但是main.cpp(与index.htmlprism.js在同一文件夹中)没有显示.我知道了:

But its not working. The piece of CSS appear there but the main.cpp (which is in the same folder as index.html and prism.js) don't show up. I got:

关于我的任何建议应该看吗?

Any suggestion on were should I look?

我不习惯html/css/js.

I'm not used to html/css/js.

推荐答案

下载棱镜时,您没有选择文件突出显示"插件.只是有同样的问题.再次下载并选择它,它对我有用.

You did not select the 'file highlight' plugin when you downloaded prism. Just had the same problem. Downloaded it again with it selected and it worked for me.

这篇关于Prismjs高亮文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆