Dave's Notebook

Data Science, Machine Learning, Artificial Intelligence, Visualization, and Complex Systems.
@sixhat@datasci.social wiki

Writing slides structure from the Topics slide in marp

May 21, 2023
I use marp to produce most of my slides and found it very interesting to layout the structure of the presentation in the Agenda/Topics slide. This slide acts as an organizer for the presentation.

I might write something like

## Topics

- Talk about awk
- Explain why Julia rocks
  - Show examples

But then I have to create the slides, and the following snippet of shell code allows me to get the code for the slides in my presentation. It takes the file.md and parses the lines starting with '- ' and produces the outline like


## Talk about awk


## Explain why Julia rocks


### Show examples

This is all acomplished with old faithfull awk.

function mdIndex { awk '/^- / {$1="";print "\n---\n\n##"$0 } / +- /{$1="";print "\n---\n\n###"$0}' $1 }

Just put it in .zprofile and you can run it like this and get the results in terminal,

$ mdIndex file.md

or you can pipe it to pbcopy and then paste the output into your editor of choice.

$ mdIndex file.md | pbcopy