JavaScript in Markdown

March 22, 2023

Step 1, create a new file named YourScript.js in the site directory.

Step 2, write the following code in the YAML of the Markdown document.

---
title: YourTitle
customjs:
 - https://yoursite/yourscript.js
---

Step 3, introduce JavaScript into Markdown.

{% for js in page.customjs %}
<script src="{{ js }}"></script>
{% endfor %}

Category

Markdown

You may also like

MarkDown 目录树锚定位 Markdown table自动修剪溢出 Markdown Notes

No comments yet, leave a comment

Sending failed, please try again.
Sending succeeded! It will be displayed in one minute, please refresh.
Newer Older