Is it possible to include external files when using Jade’s :markdown filter?

前端 未结 3 1561
忘掉有多难
忘掉有多难 2021-02-04 08:55

I\'m building an Express.js Node app and using Jade templates. Jade provides a :markdown filter which enables embedding Markdown code inside Jade:

h         


        
相关标签:
3条回答
  • 2021-02-04 09:22

    the :md modifier does not work for me either, but this works:

    html
      body
    
        // works:
    
        include file.md
    
        //- does not work:
    
        include:markdown file.md
        include:md file.md
    

    I am using docpad with the HTML5 Boilerplate template.

    You also should consider the problem of no auto-generation of including *.html.jade files of such includes:

    How to auto-generate html from jade file when only included markdown file has changed in livereload development environment?

    0 讨论(0)
  • 2021-02-04 09:25

    First, run this command:

    npm install marked --save
    

    Then, do this:

    include:md ../path/to/markdown/file.md
    
    0 讨论(0)
  • 2021-02-04 09:48

    You can include markdown files using the :md filter modifier.

    eg.

    html
      body
        include:md ../path/to/markdown/file.md
    

    Language Reference: https://pugjs.org/language/includes.html#including-filtered-text

    0 讨论(0)
提交回复
热议问题