Embed javascript in markdown

后端 未结 11 2558
[愿得一人]
[愿得一人] 2020-12-13 02:23

I\'m using the Maruku markdown processor. I\'d like this

*blah* blah \"blah\" in [markdown](blah)



        
11条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 02:52

    Different solution that might work in some cases: (the selected answer didn't work for me when I was trying to embed a CodePen example)

    • add this to your default layout:

      
      {% for js in page.customjs %}
      
      {% endfor %}
      
    • In posts where you need some JavaScript files, you can add them in the YAML front matter like so:

      ---
      layout: post
      title: Adding custom JavaScript for a specific post
      category: posts
      customjs:
       - http://code.jquery.com/jquery-1.4.2.min.js
       - http://yourdomain.com/yourscript.js
      ---
      

    The async might not be necessary or wanted but you could probably add that as a parameter in customjs. (see YAML front matter for Jekyll and nested lists for details)

提交回复
热议问题