admin管理员组文章数量:1303281
I'd like to serve javascript scripts and have them run such that people can go to my *.github.io page and see the visualizations there.
Is this possible? If so, how might I embed the javascript into the markdown?
I'd like to serve javascript scripts and have them run such that people can go to my *.github.io page and see the visualizations there.
Is this possible? If so, how might I embed the javascript into the markdown?
Share Improve this question edited Oct 3, 2014 at 6:06 Florin Pop 5,1354 gold badges28 silver badges60 bronze badges asked Oct 3, 2014 at 5:32 lollercoasterlollercoaster 16.5k35 gold badges122 silver badges181 bronze badges 3- You can use HTML and Javascript directly in those pages. – Lars Kotthoff Commented Oct 3, 2014 at 9:31
- how? I didn't think markdown specification had javascript. – lollercoaster Commented Oct 3, 2014 at 13:51
- What I'm saying is that you don't have to use markdown. You can write plain HTML with Javascript. – Lars Kotthoff Commented Oct 3, 2014 at 19:53
2 Answers
Reset to default 8From the Markdown Syntax Overview:
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.
I'm sure there's a better way to include scripts in your project, but if you really want to embed them in your markdown, there shouldn't be anything stopping you from doing the following:
# 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>
Sounds like you want to set up a bl.ocks:
This is a simple viewer for code examples hosted on GitHub Gist. Code up an example using Gist, and then point people here to view the example and the source code, live!
The main source code for your example should be named index.html. You can also include a README.md using Markdown, and a thumbnail.png for preview. The index.html can use relative links to other files in your Gist; you can also use absolute links to shared files, such as D3, jQuery and Leaflet.
Otherwise, you can embed stuff using <iframe>
.
本文标签: github pages serve javascriptd3 visualizationsStack Overflow
版权声明:本文标题:github pages serve javascriptd3 visualizations - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741744490a2395454.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论