Pandoc: autogenerate and autoreload reveal.js slides on markdown modification - pandoc

I am using pandoc to generate some slides for reveal.js. Now, when I edit the markdown file, I have to manually regenerate the HTML and then manually reload it in my browser to see the changes.
Is there a way to automate this task?

Update
I ended up creating a Python package for this: Markdownreveal.
You can install it with:
pip install markdownreveal
And start working with your presentations with:
markdownreveal my_presentation.md
You can customize the style, generate ZIPs or PDFs, upload to GitHub pages... For more information, have a look at the full project's documentation.
Old answer
Well, there is no way to configure pandoc to do that. But you can always create a script.
I made a script called pandoc-watch that watches the markdown file and, on modification (when you save your changes), it will automatically regenerate the HTML for reveal.js and it will be reloaded in your browser, using reveal.js's local server.
Note:
Made for GNU/Linux OSs.
Requires: bash, curl, npm, grunt, inotifywait.
Usage: pandoc-watch markdown_slides.md.
It is only meant for reveal.js output!
The first time is run it will download reveal.js and all the required node.js packages, so it may take some time. All the downloaded files are kept in ~/.pandoc-watch, in case you want to clean everything.

Related

Sphinx readthedocs install directory has different layout than installing on my own machine. How to make them the same?

When I run Sphinx on my machine it installs for example
developers/integration.rst into developers/integration.html
but on readthedocs it installs it in
developers/integration/index.html
This makes the use of relative links in any raw commands fail.
Is there a way to force my machine install to use the same directory structure as readthedocs? Or other solutions?
That's basically the difference between the Standalone HTML Builder and the Directory HTML Builder. You can change the builder with the sphinx-builder option of the read-the-doc configuration file, or change your build option on the command line by specifying it with -b.

Easiest way to install latest Pandoc and LaTeX on Heroku

I want to build a Markdown to PDF converter running on Heroku using Pandoc and LaTeX that I can send markdown to and it will return a PDF. On my local machine this worked fine without any problem. I am using Pandoc 2.7.3 and pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019).
Now I wanted to host this on heroku, but I just get errors for missing files when I run the pandoc command because the versions are old or don't match.
What is the easiest way to get this to run?
Heroku obviously has some limitations on the slug size (500mb), so a full tex install is not possible. It would need to be a smaller subset.
There are Buildpacks for pandoc and TeX Live, but espacially the TeX Live buildpacks seem to be outdated and is not compatible with the pandoc one if you try to run the latest version. The Apt package seems also to maintain only an older version. Is a docker image maybe the answer? https://devcenter.heroku.com/articles/container-registry-and-runtime
I am not necessarily searching for installation instructions, but rather in which way you would handle that. I am a web developer, not a dev ops, so i am really lost in this LaTeX install mess.

How should I bundle pandoc with my OpenShift application?

I've been running jekyll on OpenShift using https://github.com/openshift-quickstart/jekyll-openshift. I want to be able to rebuild my web site automatically in order to future-date posts and not have to rebuild/reupload in order to publish them. This means that I have a cron job running on OpenShift that rebuilds my jekyll site, adapting the deploy bash script from the OpenShift cartridge I am using. So far, so good.
Now I want to use pandoc in place of kramdown. Now I have a problem. How do I install pandoc as part of my application's deployment to OpenShift?
I've searched the web for an hour or so. I'm getting conflicting reports. Use puppet. Build from source, which starts with "Install the Haskell platform". I don't mind the work, but I'd like some idea which path to go down before doing down them all and tearing my hair out.
So... which path would you choose and which articles can I read to guide me through learning what I need to learn in order to do this?
Thank you.
Pandoc is written in Haskell, so you'll have to build it using cabal or stack. However once built, you can move the binary to your server:
From Installing Pandoc:
It is possible to compile pandoc such that the data files pandoc uses are embedded in the binary. (The executables in the binary are built this way.) The resulting binary can be run from any directory and is completely self-contained.
cabal update
cabal install hsb2hs
cabal install --flags="embed_data_files" pandoc pandoc-citeproc

How do I install the ES6 tmLanguage into TextMate 2?

I want to install the ES6 language syntax highlighting at https://github.com/Benvie/JavaScriptNext.tmLanguage for TextMate 2. I cloned the repo, but it has a .tmLanguage directory with multiple files (.tmTheme, .tmLanguage, etc.).
Apparently, TM2 only supports everything inside a .tmBundle. Is there any clean way to just install the language support?
I just ran into this as well. There's a (closed, unfortunately) pull request that makes possible what you and I wanted. To get it working, I used dhensche's fork and performed the following:
Quit TextMate 2
Run the following:
git clone git#github.com:dhensche/JavaScriptNext.tmLanguage.git
cd JavaScriptNext.tmLanguage
./create-bundle.sh
cp -R JavaScriptNext.tmbundle ~/Library/Application\ Support/Avian/Pristine\ Copy/Bundles/
Re-launch TextMate 2, open an ES6 file, and select "JavaScript Next" from the toolbar along the bottom of the editor.
Hopefully Benvie will integrate proper TextMate 2 support in the build process soon, since it's not far off, as dhensche demonstrated.
Update
The JavaScriptNext.tmLanguage became obsolete since the official TextMate Javascript bundle now supports the new ES features.
Old answer below:
To have the most up-to-date version you should create a new bundle in the Bundle Editor File → New (⌘N), name it for convenience JavaScript Next:
Then, from the repo, open every .tmLanguage/.tmPreferences/.tmTheme file you want to use, and add it to your newly created bundle:
Now you should be able to select the JavaScript Next grammar:
Done!

How to create PDF documentation with Sphinx in Windows

I am using Sphinx to create documentation for my Python project in Windows. I need to generate PDF documentation. I found many explanation how to do this in Linux, but no good explanation how to do this in Windows. As far as i understand I need to create Latex format with Sphinx, and than use Texworks to convert Latex to PDF. Can someone provide step by step explanation how can I do this, assuming I created documentation in Latex format and installed Texworks?
Install MiKTeX (< 200mb)
wget -nv -N http://mirrors.ctan.org/systems/win32/miktex/setup/miktex-portable-2.9.4757.exe
7z.exe x -y miktex-portable-2.9.4757.exe -o"miktex"
Add the bin directory to your path
SET Path=%Path%;%CD%\miktex\miktex\bin
Run Sphinx's "make.bat" to generate the .tex file.
SET SPHINXOPTS=-W -E
make.bat latex
Invoke MiKTeX's pdflatex:
cd build/latex
pdflatex.exe YOUR_PROJECT_NAME.tex
The resultant PDF will be in your build/latex directory
Install the full tex live distribution, it will install latex, PDF backends and texworks. Yes it is much, yes, it will dl and install for a fat hour depending on your pipe. But it will be sub gig total, and harddisks are large nowadays.
From what I see, Texworks is just a simple LaTeX editor with some build functionality and latex syntax highlighting. It is not really needed for just compiling (you could use notepad)
Then it should be a matter of simply putting the tex live binary directory i the path and doing
pdflatex <yourlatexdocument.tex>
on the cmdline, at least that is what I do with the latex output of our own documentation generating tool
As you have figured out: use Sphinx to generate LaTeX source, and then run it through a LaTex compiler to produce your PDF.
Instead of troubling yourself with installing LaTeX (which can be daunting) and getting an editor set up, I suggest that you use one of the on-line LaTeX services. You then only have to create a project in ShareLaTeX or Overleaf, for example (which are in the process of merging), upload the contents of the Sphinx build\latex directory, compile on-line, and download the finished PDF.
This works reasonably well, but since the output targets are very different (HTML vs a formal document), you may have to fiddle with the reST to get things the way you like it.

Resources