生活没有翻不过去的坎,只有翻不完的坎。

prism 实现代码高亮测试


	//使用prism实现代码高亮


	const Prism = require('prismjs');
const loadLanguages = require('prismjs/components/');
loadLanguages(['haml']);

// The code snippet you want to highlight, as a string
const code = `= ['hi', 'there', 'reader!'].join " "`;

// Returns a highlighted HTML string
const html = Prism.highlight(code, Prism.languages.haml, 'haml');

标签code highlight

最新评论