Ian*_*Ian 5 html html5 remarkjs
是否有(最好是轻量级的)方式将降价文件的原始内容包含在HTML中?
我正在使用remark.js创建幻灯片,并且希望将markdown文件与HTML分开,以便HTML非常简单(并且不会更改):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Test</title>
<link rel="stylesheet" href="style.css">
<script src="https://gnab.github.io/remark/downloads/remark-latest.min.js"></script>
</head>
<body>
<textarea id="source">
>>'paste' markdown file test.md<<
</textarea>
<script>
var slideshow = remark.create({
highlightStyle: 'darkula',
highlightLines: true
});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
理想情况下,它可以脱机运行并在本地计算机上运行(不运行Web服务器)。带有“粘贴”降价文件test.md的位显然不起作用(因此,我的问题)。我试过了:
object data="test.md" 但这会产生难看的iframe根据remarkjs wiki,您需要添加以下行来包含您的 markdown 文件
var slideshow = remark.create({
sourceUrl: 'markdown.md'
});
Run Code Online (Sandbox Code Playgroud)
下面是一个完整的例子
<!DOCTYPE html>
<html>
<head>
<title>A title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
body { font-family: 'Droid Serif'; }
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: normal;
}
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
</style>
</head>
<body>
<script src="https://remarkjs.com/downloads/remark-latest.min.js" type="text/javascript">
</script>
<script type="text/javascript">
var slideshow = remark.create({
sourceUrl: 'your_file.md'
});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
745 次 |
| 最近记录: |