Pandoc Markdown Lecture Template: This project defines a skeleton repo for creating lecture slides and handouts including lecture notes out of Pandoc Markdown (https://pandoc.org/MANUAL.html) using a single source approach.
MIT License
100
stars
18
forks
source link
Filter: Allow "warping", i.e. to remove folder parts (makedeps) #146
Using the filter "hugo_makedeps.lua" we can transform a preview-friendly folder/file structure (e.g., preview in GitHub, VSCode, Obsidian) into a structure suitable for Hugo.
However, we keep the original folder structure. All folders become a folder in the menu generated by Hugo. In some cases, however, this is not desirable.
This would lead to a menu containing the entries "admin", "homework" and "lecture". Since "admin" and "homework" are usually hidden (accessible only via direct links), this would lead to a single toplevel entry "lecture". In this case it would be much desirable to skip the folder "lecture" and to promote the content (i.e. the topics in this example) as toplevel menu entries.
This PR introduces a "warping" feature. Using the metadata field warp the filter will remove this part from the generated target paths. A pandoc -L hugo_makedeps.lua -M warp="lecture" -t markdown readme.md will remove the part "lecture" from the generated Makefile targets, so that "topic_a", "topic_b", ... will be on the same level as "homework" and "admin".
WARNING: In this example we "remove" the subfolder 'lecture' from the target hierarchy. Since the readme in this level would now overwrite the readme in the parent level, it will be skipped - as will all files in 'lecture' with the same name as those in the parent level! Also potential links in 'lecture/readme.md' and other skipped files will not be analysed and considered! Subsequently, the build with Hugo can fail as the links are still in the files but the linked-to files are missing.
Using the filter "hugo_makedeps.lua" we can transform a preview-friendly folder/file structure (e.g., preview in GitHub, VSCode, Obsidian) into a structure suitable for Hugo.
However, we keep the original folder structure. All folders become a folder in the menu generated by Hugo. In some cases, however, this is not desirable.
Consider the following structure:
This would lead to a menu containing the entries "admin", "homework" and "lecture". Since "admin" and "homework" are usually hidden (accessible only via direct links), this would lead to a single toplevel entry "lecture". In this case it would be much desirable to skip the folder "lecture" and to promote the content (i.e. the topics in this example) as toplevel menu entries.
This PR introduces a "warping" feature. Using the metadata field
warp
the filter will remove this part from the generated target paths. Apandoc -L hugo_makedeps.lua -M warp="lecture" -t markdown readme.md
will remove the part "lecture" from the generated Makefile targets, so that "topic_a", "topic_b", ... will be on the same level as "homework" and "admin".WARNING: In this example we "remove" the subfolder 'lecture' from the target hierarchy. Since the readme in this level would now overwrite the readme in the parent level, it will be skipped - as will all files in 'lecture' with the same name as those in the parent level! Also potential links in 'lecture/readme.md' and other skipped files will not be analysed and considered! Subsequently, the build with Hugo can fail as the links are still in the files but the linked-to files are missing.