docker-reveal.js icon indicating copy to clipboard operation
docker-reveal.js copied to clipboard

Hmmm, Instructions did not work for me... But I was able to fix it

Open kfries opened this issue 9 years ago • 1 comments

I am trying to use the docker-reveal.js docker container, and it appears to run as a server, but it does not seem to be converting the Markdown file into HTML correctly. I have the server running:

$ docker ps
CONTAINER ID        IMAGE                              COMMAND                CREATED             STATUS              PORTS                    NAMES
28dda7209d63        danidemi/docker-reveal.js:latest   "/bin/sh -c 'grunt s   3 minutes ago       Up 3 minutes        0.0.0.0:8000->8000/tcp   pandoc

And my markdown file should be fine... I really have not added much to it:

% Fun with Ruby: Ruby On Rails
% Kevin Fries
% 9 May 2015

# Ruby On Rails

# Fun With Ruby Series
## Welcome

  - Introductions
      - Me
          - Denver/Boulder Linux Meetup Group
      - David
          - Software Freedom School
  - Agenda

## Technology Overview

  - Ruby vs Rails                                                                                                                              
      - What is Ruby?                                                                                                                          
      - What is Rails?                                                                                                                         
      - Why would Ruby want to be on "Rails"?                                                                                                  
  - ***My Definitions:***
      - Website
      - Web App

# What Ruby Pieces do we need to know?
## Overview

## Array Methods

## Classes

## Bundler

## Rake

# Rails Technology in details
## Overview

## MVC Development Model

## The Model

## The View

## The Controller

# Restful Interfaces
## What makes a program "REST"ful

## Mapping REST verbs

You have a little bit of a chicken and egg going on with your process here, but it is easily kludged around. If you are writing in Markdown, and trying to convert this to HTML, the container will not start unless index.html is present. So... you need to touch the index.html file to create it, even though you are just going to crush it in a moment. No big, I figured when I read your page, that I could skip that because I was using Markdown... but quickly gotten around.

So, I did a touch, and then ran my command again. Here is my revealjs start script:

#!/usr/bin/env bash

docker run -dit \
           --name pandoc
           -v $(pwd):/slides/ -p 8000:8000 \
           danidemi/docker-reveal.js:latest

pretty much what you had in the documents, with a few small modifications. I used the -i and -t, so in case needed to get into the container, it was easy to get back out via a ^C. And I named the container for reasons that will become obvious here in just a moment.

Now that the container is running, I tried to convert my Markdown into the HTML page so I could check how the slides would show up.

#!/usr/bin/env bash

filename=$1

if [ -z $filename ]; then filename=index.md; fi

target=$(basename $filename .md).html

$(docker exec -it pandoc /bin/sh -c "pandoc -t revealjs -s -o /slides/$target") < $filename

I called this script md2html, and again, I used your code almost verbatim. I simply adjust the script to work with an optional filename. No filename, and it will default to index.md, otherwise, it will set the output file to be the same name as the markdown file, only with an html extention. I insured that the correct instance was used by using that name I set in the revealjs file. I also added the -i and -t switches since it did not work without them...

but it does not seem to work any better with the -t and -i switches either.

With all the history of what I am doing out of the way, lets talk about how I fixed it.

When I run the md2html command, the process just seems to hang. No output seems to be going out:

$ ls -la
total 12
drwxr-xr-x 2 kfries kfries 4096 May  2 05:34 .
drwxr-xr-x 4 kfries kfries 4096 May  1 19:02 ..
-rw-r--r-- 1 kfries kfries    0 May  2 05:34 index.html
-rw-r--r-- 1 kfries kfries  737 May  1 20:15 index.md

Notice that the filesize of index.html is still zero, and this has been running for 15 minutes.

I ran the pandoc commands from the terminal individually, and found that there were errors in the command... for example, it did not like the -s switch. The process hung due to an error in the command it was trying to run inside the container.

I simplified the command, and took it out of the subshell. Pandoc will take an unnamed parameter as the source... no need to pipe it in, since the file was in the pwd, it is seen inside the container as /slides/, so /slides/index.md as the last parameter, and viola, no more pipe, or need for a subshell.

Now errors are appearing on the screen, and the process is ending. But the file it generated was not white right...

So, I tried to fix it. It took a few tries... But! SUCCESS! I got a nice looking slide show. The only adjustment I really needed to make in the end was to the convert command. Here is my final version, and it works great on my AWS hosted CoreOS System online:

#!/usr/bin/env bash

filename=$1

if [ -z $filename ]; then filename=index.md; fi

target=$(basename $filename .md).html

docker exec -it pandoc \
   pandoc --standalone \
          --section-divs \
          --variable theme="beige" \
          --variable transition="linear" \
          -t revealjs \
          -o /slides/$target \
          /slides/$filename

Hope this helps somebody else.

Kevin

kfries avatar May 02 '15 06:05 kfries

You, Sir, are amazing. This is exactly what I needed as I didn't have the time to debug this myself.

💯

icirellik avatar May 23 '16 17:05 icirellik