从版本 3 升级到 4.0

¥Upgrading From Version 3 to 4.0

我们尽力避免重大变更,但 4.0 版本中还是有一些重大变更。如果你想迁移现有的演示文稿,请按照以下说明操作。

¥We make a strong effort to avoid breaking changes but there are a couple in version 4.0. If you want to migrate an existing presentation follow these instructions.

更新资源位置

¥Update Asset Locations

我们的 JS 和 CSS 资源已移动。在你的演示文稿 HTML 中,更新以下 <script><link> 路径:

¥Our JS and CSS assets have moved. In your presentation HTML, update the following <script> and <link> paths:

旧位置新位置
js/reveal.jsdist/reveal.js
css/reset.cssdist/reset.css
css/reveal.cssdist/reveal.css
css/theme/<theme-name>.cssdist/theme/<theme-name>.css
lib/css/monokai.cssplugin/highlight/monokai.css
lib/js/head.min.js已于 3.8.0 版本删除

<head> 中移除打印 CSS

¥Remove Print CSS from <head>

在你的演示文稿 HTML 中,从 <head> 中删除以下脚本。这些样式现已嵌入到 reveal.css 文件中。

¥In your presentation HTML, remove the following script from the <head>. These styles are now baked into the reveal.css file.

<script>
  var link = document.createElement('link');
  link.rel = 'stylesheet';
  link.type = 'text/css';
  link.href = window.location.search.match(/print-pdf/gi)
    ? 'css/print/pdf.css'
    : 'css/print/paper.css';
  document.getElementsByTagName('head')[0].appendChild(link);
</script>

插件注册

¥Plugin Registration

如果你保留 v3 /plugin 目录的副本,则不会发生重大更改。如果你想切换到最新的插件版本,你需要更新你的 Reveal.initialize() 调用以使用 新的插件注册语法。插件也可以作为 ES 模块使用。

¥If you keep a copy of the v3 /plugin directory there are no breaking changes. If you want to switch to the latest plugin versions, you'll need to update your Reveal.initialize() call to use the new plugin registration syntax. Plugins are also available as ES modules.

<script src="dist/reveal.js"></script>
<script src="plugin/markdown/markdown.js"></script>
<script src="plugin/highlight/highlight.js"></script>
<script>
  Reveal.initialize({
    plugins: [RevealMarkdown, RevealHighlight],
  });
</script>

移除 Multiplex 和 Notes 服务器

¥Removed Multiplex and Notes Server

Multiplex 和 Notes Server 插件已从 reveal.js 核心移至其自己的代码库。有关使用说明,请参阅其相应的 README 文件。

¥The Multiplex and Notes Server plugins have moved out of reveal.js core to their own repositories. See their corresponding README's for usage instructions.

其他

¥Other

  • 已删除 Reveal.navigateTo,请使用 Reveal.slide 代替。

    ¥Removed Reveal.navigateTo, use Reveal.slide instead.

  • 我们已将构建系统切换为 gulp 和 rollup。确保 npm install 以获取最新的依赖。服务器仍然以 npm start 启动,与以前一样。

    ¥We've switched build systems to gulp & rollup. Make sure to npm install to get the latest dependencies. The server is still started with npm start, just like before.