search

Home  >  Q&A  >  body text

node.js - nodejs中jade过滤器中使用markdown,怎么实现mardkown文件中代码高亮?

index.jade

doctype html
    html
      head
        title An Article
      body
        include:markdown article.md

article.md

<p class="container">content</p>

现在虽然把article.md文件解析了,但是代码不能实现高亮,请问下如何才能实现代码高亮呢。

阿神阿神2785 days ago718

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 11:20:40

    MarkdownAfter the file parsing is completed, it will be HTMl. It should be possible to directly add PrittyPrint style highlighting code to HTML.

    Or you can use Remark.js directly in HTML to display the markdown file on the client, so there is no need to include jade in markdown.

    reply
    0
  • 黄舟

    黄舟2017-04-17 11:20:40

    After loading the html, load PrettyPrint to process the code, refer to the example here: http://witcheryne.iteye.com/blog/1172068

    reply
    0
  • Cancelreply