Skip to content

Instantly share code, notes, and snippets.

@juanbono
Forked from lukego/gist:3952159
Created December 2, 2019 23:19
Show Gist options
  • Save juanbono/5f09876c3393ca801fce69e4a9db7c3b to your computer and use it in GitHub Desktop.
Save juanbono/5f09876c3393ca801fce69e4a9db7c3b to your computer and use it in GitHub Desktop.
Erlang literate programming
Simple literate programming.
Add comments to your Erlang file with a special %%% syntax, like this:
%%% This is a comment that will be formatted in a variable width font with Markdown.
%%% You can use *emphasis* and
%%% # Headings
%%% and even
%%%
%%% - Lists
%%% - of
%%% - things
%%%
%%% while the rest of the code is formatted like normal.
Then format the file by using sed to convert to Markdown and pandoc to convert to PDF:
sed -E -e 's/^/ /g' -e 's/^ %%% ?//g' | pandoc --toc -o listing.pdf -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment