markdown-preprocessor
A preprocessor for markdown designed to make document sites for Github Pages. It extends gitdown.
Installation
npm i markdown-preprocessor
Usage
See the gitdown usage for the gitdown features.
markdown-preprocessor --src ./src --dest ./docs --home-url https://example.com --generate-index --generate-header --generate-footer --remove-link-fileext
Features
Images
Options
url
: The url for the image.link
(optional): Clickable link for the image.alt
(optional): Alt text for the image.center
(optional): Center the image. Default is true.
{"gitdown": "image", "url": "https://search.chow.com/thumbnail/640/0/www.chowstatic.com/assets/2014/12/10836_creamy_tomato_soup_original_3000_2.jpg"}
Generates:
Embed a video
Options
- Need one of
key
or url
: key
(optional): The video key for the youtube video.url
(optional): The url for the youtube video.timestamps
(optional): An array of strings (eg "0m10s:a note") with timestamps for the video, generates a table with links to the time codes.collapse
(optional): Wrap the video in a collapsible bar.
With a key
{"gitdown": "video:youtube", "key": "Dvi8P-lhJmE"}
With a full url and hidden under a collapse
{"gitdown": "video:youtube", "url": "https://www.youtube.com/watch?v=Dvi8P-lhJmE", "collapse": true, "collapseSummary": "Every Matthew McConaughey "Alright" In Chronological Order (1993 - 2017)"}
// With timestamps
// Note see nested object parsing limitation,
// And Solution: https://stackoverflow.com/questions/26910402/regex-to-match-json-in-a-document/26910403
{"gitdown": "video:youtube", "key": "Dvi8P-lhJmE", "timestamps": [
"0m10s:a note",
"0m20s:another note",
"0m30s:yet another note"
]}
Generates:
Embed site
As a card
Options
url
: The url for the site.
{"gitdown": "site:card", "url": "https://www.foundmyfitness.com/"}
Generates:
https://www.foundmyfitness.com/
www.foundmyfitness.com
Promoting strategies to increase healthspan, well-being, cognitive and physical performance through deeper understandings of nutrition, genetics, and cell biology.
As an iframe
Options
url
: The url for the site.
{"gitdown": "site:embed", "url": "https://www.foundmyfitness.com/"}
Generates:
https://www.foundmyfitness.com/
Generate index pages
This is enabled by the cli command --generate-index
.
Your folder structure will be recursively walked and index.md
pages will be created for all folders populated with links to files and folders within.
Generates:
Folder Name
📁 ExampleFolder
📄 ExampleFile
This is enabled by the cli command --generate-header
.
Generates a header including the file name
This is enabled by the cli command --generate-footer
.
Generates a footer including navigation buttons.
Remove file extensions
This allows better linking in GitHub pages but will break any locally hosted links. Enabled via --remove-link-fileext
Debugging
You can enable verbose logging with the --verbose
flag.