Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pandoc doesn't work with reveal.js 4.x #6431

Closed
nicolasshu opened this issue Jun 6, 2020 · 3 comments
Closed

Pandoc doesn't work with reveal.js 4.x #6431

nicolasshu opened this issue Jun 6, 2020 · 3 comments
Labels

Comments

@nicolasshu
Copy link

Bug
pandoc version: 2.9.2.1

Reproduce Steps

Step 1

Create a base Markdown file
test.md

---
title: Facebook
subtitle: How I want to take over the world
author: 
- Mark Zuckerberg
variant: markdown+backtick_code_blocks
---

## What is Google

- A glorified version of Facebook
- Closest thing to AI we can get

Step 2

Get the newest RevealJS

$ git clone https://github.com/hakimel/reveal.js.git
$ cd reveal.js && npm install
$ cd ..

Step 3

Compile a RevealJS HTML file

$ pandoc test.md -f markdown -t revealjs -o test.html --standalone

Step 4: Trying to see the output

Error on the Firefox console

SyntaxError: import declarations may only appear at top level of a module reveal.js:1
ReferenceError: Reveal is not definedtest.html:60:7

Trying via a local server

On the same location, enter the following command and go to http://0.0.0.0:8000/ on your browser

$ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0.1 - - [05/Jun/2020 21:15:12] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [05/Jun/2020 21:15:14] "GET /test.html HTTP/1.1" 200 -
127.0.0.1 - - [05/Jun/2020 21:15:14] code 404, message File not found
127.0.0.1 - - [05/Jun/2020 21:15:14] "GET /reveal.js/css/reveal.css HTTP/1.1" 404 -
127.0.0.1 - - [05/Jun/2020 21:15:14] code 404, message File not found
127.0.0.1 - - [05/Jun/2020 21:15:14] "GET /reveal.js/css/reset.css HTTP/1.1" 404 -
127.0.0.1 - - [05/Jun/2020 21:15:14] code 404, message File not found
127.0.0.1 - - [05/Jun/2020 21:15:14] "GET /reveal.js/js/reveal.js HTTP/1.1" 200 -
127.0.0.1 - - [05/Jun/2020 21:15:14] "GET /reveal.js/css/theme/black.css HTTP/1.1" 404 -
127.0.0.1 - - [05/Jun/2020 21:15:14] code 404, message File not found
127.0.0.1 - - [05/Jun/2020 21:15:14] "GET /reveal.js/css/print/paper.css HTTP/1.1" 404 -

A Few of the Problems I've found

  1. Whatever happened in an update, the CSS files are not located in /reveal.js/css/. Now they are in /reveal.js/dist/
  2. The class Reveal that is located in /reveal.js/js/reveal.js is no longer being able to be properly imported. In older versions of, the class Reveal was declared as var, but now it is declared as const. The fact that this class is not being properly imported breaks all of the other functionality, thus rendering a basic HTML without any styling
@nicolasshu
Copy link
Author

Here is the test.html in case you wish to see

Output File: test.html

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="generator" content="pandoc">
  <meta name="author" content="Mark Zuckerberg">
  <title>Facebook</title>
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
  <link rel="stylesheet" href="reveal.js/css/reset.css">
  <link rel="stylesheet" href="reveal.js/css/reveal.css">
  <style>
    code{white-space: pre-wrap;}
    span.smallcaps{font-variant: small-caps;}
    span.underline{text-decoration: underline;}
    div.column{display: inline-block; vertical-align: top; width: 50%;}
    div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
    ul.task-list{list-style: none;}
  </style>
  <link rel="stylesheet" href="reveal.js/css/theme/black.css" id="theme">
  <!-- Printing and PDF exports -->
  <script>
    var link = document.createElement( 'link' );
    link.rel = 'stylesheet';
    link.type = 'text/css';
    link.href = window.location.search.match( /print-pdf/gi ) ? 'reveal.js/css/print/pdf.css' : 'reveal.js/css/print/paper.css';
    document.getElementsByTagName( 'head' )[0].appendChild( link );
  </script>
  <!--[if lt IE 9]>
  <script src="reveal.js/lib/js/html5shiv.js"></script>
  <![endif]-->
</head>
<body>
  <div class="reveal">
    <div class="slides">

<section id="title-slide">
  <h1 class="title">Facebook</h1>
  <p class="subtitle">How I want to take over the world</p>
  <p class="author">Mark Zuckerberg</p>
</section>

<section id="what-is-reinforcement-learning" class="slide level2">
<h2>What is Reinforcement Learning?</h2>
<ul>
<li>A glorified version of Optimal Control</li>
<li>Closest thing to AI we can get</li>
</ul>
</section>
    </div>
  </div>

  <script src="reveal.js/js/reveal.js"></script>

  <script>

      // Full list of configuration options available at:
      // https://github.com/hakimel/reveal.js#configuration
      Reveal.initialize({
        // Push each slide change to the browser history
        history: true,

        // Optional reveal.js plugins
        dependencies: [
          { src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
          { src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
          { src: 'reveal.js/plugin/notes/notes.js', async: true }
        ]
      });
    </script>
    </body>
</html>
~        

@mb21
Copy link
Collaborator

mb21 commented Jun 6, 2020

Yeah, looks like revealjs 4.x is not 100% API-compatible with 3.x.... but the following works:

pandoc -s -t input.md -o output.html -V revealjs-url='https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.9.2'

@mb21 mb21 changed the title Pandoc no longer works with RevealJS Pandoc doesn't work with reveal.js 4.x Jun 6, 2020
@mb21 mb21 added the writer label Jun 6, 2020
@mb21
Copy link
Collaborator

mb21 commented Jun 6, 2020

ah, actually on current master of pandoc, this should already be fixed – will be in pandoc 2.9.3.

meanwhile, you can try a nightly-build.

@mb21 mb21 closed this as completed Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@mb21 @nicolasshu and others