prismjs

Static html generation with prismjs - how to enable line-numbers?

回眸只為那壹抹淺笑 提交于 2020-12-09 17:49:49
问题 I'm using node.js to generate static html files from code, formatting them with prismjs. Within my app, I do not have access to an HTML renderer that supports Javascript (I'm using 'htmllite'). So I need to be able to generate HTML that does not require Javascript. const Prism = require('prismjs'); const loadLanguages = require('prismjs/components/'); loadLanguages(['csharp']); const code = '<a bunch of C# code>'; const html = Prism.highlight(code, Prism.languages.csharp, 'csharp'); This

Static html generation with prismjs - how to enable line-numbers?

只谈情不闲聊 提交于 2020-12-09 17:44:33
问题 I'm using node.js to generate static html files from code, formatting them with prismjs. Within my app, I do not have access to an HTML renderer that supports Javascript (I'm using 'htmllite'). So I need to be able to generate HTML that does not require Javascript. const Prism = require('prismjs'); const loadLanguages = require('prismjs/components/'); loadLanguages(['csharp']); const code = '<a bunch of C# code>'; const html = Prism.highlight(code, Prism.languages.csharp, 'csharp'); This

Static html generation with prismjs - how to enable line-numbers?

别说谁变了你拦得住时间么 提交于 2020-12-09 17:43:40
问题 I'm using node.js to generate static html files from code, formatting them with prismjs. Within my app, I do not have access to an HTML renderer that supports Javascript (I'm using 'htmllite'). So I need to be able to generate HTML that does not require Javascript. const Prism = require('prismjs'); const loadLanguages = require('prismjs/components/'); loadLanguages(['csharp']); const code = '<a bunch of C# code>'; const html = Prism.highlight(code, Prism.languages.csharp, 'csharp'); This

Static html generation with prismjs - how to enable line-numbers?

萝らか妹 提交于 2020-12-09 17:42:56
问题 I'm using node.js to generate static html files from code, formatting them with prismjs. Within my app, I do not have access to an HTML renderer that supports Javascript (I'm using 'htmllite'). So I need to be able to generate HTML that does not require Javascript. const Prism = require('prismjs'); const loadLanguages = require('prismjs/components/'); loadLanguages(['csharp']); const code = '<a bunch of C# code>'; const html = Prism.highlight(code, Prism.languages.csharp, 'csharp'); This

Static html generation with prismjs - how to enable line-numbers?

别说谁变了你拦得住时间么 提交于 2020-12-09 17:42:16
问题 I'm using node.js to generate static html files from code, formatting them with prismjs. Within my app, I do not have access to an HTML renderer that supports Javascript (I'm using 'htmllite'). So I need to be able to generate HTML that does not require Javascript. const Prism = require('prismjs'); const loadLanguages = require('prismjs/components/'); loadLanguages(['csharp']); const code = '<a bunch of C# code>'; const html = Prism.highlight(code, Prism.languages.csharp, 'csharp'); This

Prismjs highlight file

送分小仙女□ 提交于 2020-08-05 17:08:47
问题 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

Prismjs highlight file

↘锁芯ラ 提交于 2020-08-05 17:04:23
问题 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

How to add copy to clipboard functionality in vuejs with prismjs?

百般思念 提交于 2019-12-23 23:25:52
问题 I am displaying Html syntax using vue-prism-component (https://www.npmjs.com/package/vue-prism-component). Now I want to add a button that should copy the code. So far, I have found a library vue-clipboard2 (https://www.npmjs.com/package/vue-clipboard2) in this they are getting text from an input tag. How I would select the syntax of Html generated by vue-prism-component on a click of button. 回答1: Prism has some documentation for implementing such feature https://prismjs.com/plugins/copy-to