我想提供 javascript 脚本并让它们运行,以便人们可以转到我的 *.github.io 页面并查看那里的可视化效果。
这可能吗?如果是这样,我如何将 javascript 嵌入到 markdown 中?
最佳答案
For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.
我确信有更好的方法可以在您的项目中包含脚本,但是如果您真的想将它们嵌入到您的 markdown 中,那么没有什么可以阻止您执行以下操作:
# This is a title
> this is a blockquote
<script>
// this is a script that renders a chart
var chart = d3.select('body').append('svg')
// ...etc...
</script>
关于javascript - github 页面提供 javascript/d3 可视化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26173731/