mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 18:25:45 +00:00
| .. | ||
| src | ||
| mkdocs.yml | ||
| README.md | ||
| regen.sh | ||
| retitle | ||
Miller docs
Why use Mkdocs
- Connects to https://miller.readthedocs.io so people can get their docmods onto the web instead of the self-hosted https://johnkerl.org/miller/doc. Thanks to @pabloab for the great advice!
- More standard look and feel -- lots of people use readthedocs for other things so this should feel familiar.
- We get a Search feature for free.
- Mkdocs vs Sphinx: these are similar tools, but I find that I more easily get better desktop+mobile formatting using Mkdocs.
Contributing
- You need
pip install mkdocs(orpip3 install mkdocs) as well aspip install mkdocs-material. - The docs include lots of live code examples which will be invoked using
mlrwhich must be somewhere in your$PATH. - Clone https://github.com/johnkerl/miller and cd into
docs6/within your clone. - Overview of flow:
docs6/srchas*.md.infiles containing markdown as well as directives for auto-generating code samples.- A
genmdsscript readsdocs6/src/*.md.inand writesdocs6/src/*.md. - The
mkdocs buildtools readsdocs6/src/*.mdand writes HTML files indocs6/site.
- Quick-editing loop:
- In one terminal, cd to this directory and leave
mkdocs serverunning. - In another terminal, cd to the
srcsubdirectory ofdocs6and edit*.md.in. - Run
genmdsto re-create all the*.mdfiles, orgenmds foo.md.into just re-create thefoo.md.infile you just edited. - In your browser, visit http://127.0.0.1:8000
- This doesn't write HTML in
docs6/site; HTML is served up directly in the browser -- this is nice for previewing interactive edits
- In one terminal, cd to this directory and leave
- For-publish editing loop:
- Leave one terminal open as a place you will run
mkdocs build - In one terminal, cd to the
srcsubdirectory ofdocs6and edit*.md.in. - Generate
src/*.mdfromsrc/*.md.in, and then from that generate thesite/*/*.html:- Run
genmdsto re-create all the*.mdfiles, orgenmds foo.md.into just re-create thefoo.md.infile you just edited. - In the first terminal, run
mkdocs buildwhich will populate thesitedirectory. - See also ./regen.sh which combines the
genmdsandmkdocs buildsteps.
- Run
- This does write HTML in
docs6/site. - In your browser, visit
file:///your/path/to/miller/docs6/site/index.html - Link-checking:
sudo pip3 install git+https://github.com/linkchecker/linkchecker.gitcd siteandlinkchecker .
- Leave one terminal open as a place you will run
- Submitting:
- Do the for-publish editing steps -- in particular,
docs6/src/*md.inanddocs6/src/*mdare both checked in to source control. git addyour modified files,git commit,git push, and submit a PR at https://github.com/johnkerl/miller.
- Do the for-publish editing steps -- in particular,
Notes
- CSS:
- I used the Mkdocs Readthedocs theme which I like a lot. I customized
docs6/src/extra.cssfor Miller coloring/branding.
- I used the Mkdocs Readthedocs theme which I like a lot. I customized
- Live code:
- I didn't find a way to include non-Python live-code examples within Mkdocs so I adapted the pre-Mkdocs Miller-doc strategy which is to have a generator script read a template file (here,
foo.md.in), run the marked lines, and generate the output file (foo.md). This isgenmds. - Edit the
*.md.infiles, not*.mddirectly. - Within the
*.md.infiles are lines likeGENMD_RUN_COMMAND. These will be run, and their output included, bygenmdswhich calls thegenmdsscript for you.
- I didn't find a way to include non-Python live-code examples within Mkdocs so I adapted the pre-Mkdocs Miller-doc strategy which is to have a generator script read a template file (here,
- readthedocs: