reveal.js + markdown 制作幻灯片

reveal.js + markdown 制作幻灯片——0

在这里插入图片描述

reveal.js是一款通过利用HTML快速创建演示文稿,并且具有很多功能:垂直,水平幻灯片;支持Markdown,LaTex;演讲者注释;可插入代码片段;可选用图片,视频等作为幻灯片背景;可导出为PDF;以及有多种插件选择。

本文为快速上手reveal.js,通过引用外部Markdown文件编写幻灯片

1. 下载reveal.js

npm install
  • 完成后终端键入
npm start

2. 基本使用

  • 修改index.html<body>后面:
	<body>
		<div class="reveal">
			<div class="slides">
				<section data-markdown="main.md"
						 	data-transition="convex"
							data-separator="^\r?\n----\r?\n$"
							data-separator-vertical="^\r?\n--\r?\n$"
							data-separator-notes="^Note:"
         					data-charset="utf-8">
				</section>
			</div>			
		</div>

其中,data-separator定义横向幻灯:这里是空行+----+空行控制幻灯片分页。data-separator-vertical定义纵向幻灯片分页方式:这里是空行+--+空行

  • 公式方面,<body>后相应添加
<script src="plugin/math/math.js"></script>

并在最后plugsin里添加RevealMath.KaTex

plugins: [ RevealMarkdown, RevealHighlight, RevealNotes, RevealMath.KaTeX ]
			});
  • 插入代码

    • markdown语法:行内代码使用反引号包裹,代码块使用三个反引号```
    • 语法高亮配置:
      通过在index.heml中,对下面的配置选项修改即可
      <link rel="stylesheet" href="plugin/highlight/monokai.css">
      <script src="plugin/highlight/highlight.js"></script>
      <script>
        Reveal.initialize({
          plugins: [ RevealHighlight ]
        });
      </script>
      
  • 在 reveal.js 文件夹下新建 slides.md,里面Markdown语法写幻灯片即可

  • 终端打开项目根目录键入npm start,在http://localhost:8000/中查看幻灯片

3. 主题与过渡动画

  • index.html中的<head>部分定义theme,例如这里是默认的black.css
<link rel="stylesheet" href="dist/theme/black.css">

基本类型参考官网给出的有:

NameEffect
blackBlack background, white text, blue links (default)
whiteWhite background, black text, blue links
leagueGray background, white text, blue links
beigeBeige background, dark text, brown links
skyBlue background, thin dark text, blue links
nightBlack background, thick white text, orange links
serifCappuccino background, gray text, brown links
simpleWhite background, black text, blue links
solarizedCream-colored background, dark green text, blue links
bloodDark background, thick white text, red links
moonDark blue background, thick grey text, blue links
  • 过渡动画(transition)在<body><div class="slides">后定义:
<section data-markdown="main.md"
						 	data-transition="convex"
							...>

官网给出的基本过渡样式有:

NameEffect
noneSwitch backgrounds instantly
fadeCross fade — default for background transitions
slideSlide between backgrounds — default for slide transitions
convexSlide at a convex angle
concaveSlide at a concave angle
zoomScale the incoming slide up so it grows in from the center of the screen

修改data-transition后的内容即可,例如这里是convex

4. 一个mian.md例子

main.md

reveal.js例子-main

幻灯片

5. 关于vscode中Markdown

例如参考:https://zhuanlan.zhihu.com/p/139140492

6. Markdown基本语法

参考链接

7. 好用的参考资料

1.https://github.com/dsebastien/presentations-revealjs

参考文献

[1] 官网

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值