Skip to content

Instantly share code, notes, and snippets.

@petered
Last active May 7, 2018 09:37
Show Gist options
  • Save petered/af68fa12f2966f779b1bcb690eb68a73 to your computer and use it in GitHub Desktop.
Save petered/af68fa12f2966f779b1bcb690eb68a73 to your computer and use it in GitHub Desktop.

Making a Markdown Report

This is a method for making quick markdown reports for things like weekly meetings. Suggestions for improvement are welecome.

This tutorial shows us how to make this sample document

Positives:

  • You write in markdown and can insert latex inline
  • You can edit your document in the browser offline (and it will sync when you get back online)
  • You can insert plots
  • Your document can be shared online
  • You can update the plots in your document just by saving them locally.

Negatives:

  • No collaborative editing
  • Adding figures is a bit cumbersome and has more steps than it seems like it should.

Alternatives:

  • Google's Colab notebooks are handy and let you add and run python code and plot from inside the notebook. The steps for adding figures generated outside the notebook are the same as here.

This lets you easily generate a markdown document with latex, put figures in it, and let you share it online.

1) Open StackEdit (use the old edition, the new one is worse): at https://stackedit.io/editor.

StackEdit is great because it lets you work offline, automatically syncs to google drive when online, and lets you share the document. You can optionally paste a preamble with useful latex shortcuts, e.g. I use:

$$
\newcommand{\pderiv}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\lderiv}[1]{\frac{\partial \mathcal L}{\partial #1}}
\newcommand{\argmax}[1]{\underset{#1}{\operatorname{argmax}}}
\newcommand{\argmin}[1]{\underset{#1}{\operatorname{argmin}}}
\newcommand{\switch}[3]{\begin{cases} #2 & \text{if } {#1} \\ #3 &\text{otherwise}\end{cases}}
$$

2) Get Google Drive for Mac to sync your google drive to your computer.

3) When you need to add a plot to your document, save it as a png to your google drive local folder.

4) On the google-drive website, get the sharing link to your plot using the "Share..." button (not the "Get Sharable Link" button):

5) Unfortunately, this link won't work for inserting an image. Convert it to a download-link with the Google Drive Direct Link Generator

6) Now you can add the image into your markdown document.

We add the line with the copied URL ![](https://drive.google.com/uc?export=download&id=1aVrpacFQPnnODgLDiBtW6n8oCr3z2m1t)

Note that if your overwrite the image on your local harddrive, the changes will be reflected in your document.

7) To share your document in StackEdit:

i) Go to Menu (#) -> Publish -> Gist, give it a name, and publish

ii) Go to Menu (#) -> Sharing and copy the URL.

The link to this sample document is here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment