{"id":13511203,"url":"https://github.com/mb21/panrun","last_synced_at":"2025-03-22T07:32:10.397Z","repository":{"id":136618810,"uuid":"149026713","full_name":"mb21/panrun","owner":"mb21","description":"Script that looks at the YAML metadata in a markdown file and runs pandoc for you.","archived":false,"fork":false,"pushed_at":"2024-03-28T08:40:31.000Z","size":14,"stargazers_count":52,"open_issues_count":2,"forks_count":6,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-18T09:37:41.249Z","etag":null,"topics":["markdown","pandoc","yaml"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mb21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-16T19:04:23.000Z","updated_at":"2025-02-22T06:25:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"a8f29787-4971-4aca-9b8a-d5026faaa037","html_url":"https://github.com/mb21/panrun","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mb21%2Fpanrun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mb21%2Fpanrun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mb21%2Fpanrun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mb21%2Fpanrun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mb21","download_url":"https://codeload.github.com/mb21/panrun/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244925175,"owners_count":20532873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["markdown","pandoc","yaml"],"created_at":"2024-08-01T03:00:37.951Z","updated_at":"2025-03-22T07:32:10.391Z","avatar_url":"https://github.com/mb21.png","language":"Ruby","funding_links":[],"categories":["Command Line Utilities"],"sub_categories":[],"readme":"# Panrun\n\nMinimal script that runs [pandoc](http://pandoc.org/) with the options it finds in the YAML metadata of the input markdown file. For example:\n\n    panrun input.md\n\nwith the following `input.md`:\n\n    ---\n    title: my document\n    output:\n      html:\n        standalone: true\n        output: test.html\n        include-in-header:\n          - foo.css\n          - bar.js\n      latex:\n        toc: true\n        toc-depth: 3\n        output: test.pdf\n        template: letter.tex\n        metadata:\n          fontsize: 12pt\n    ---\n\n    # my content\n\nWill execute:\n\n    pandoc test.md --standalone --output test.html --include-in-header foo.css --include-in-header bar.js\n\nNote how panrun defaults to using the first key in the YAML, in this case `html`.\n\n\n## Usage\n\n    panrun input-file [pandoc-options]\n\nYou can also supply more options, but only _after_ the input file. They will be forwarded to pandoc. Panrun also looks at the `-o` (`--output`) and `-t` (`--to`) options to determine the output format. For example:\n\n    panrun input.md -t latex -o test.pdf\n\nPanrun will only look at the YAML in the first input-file, but more are passed along to pandoc:\n\n    panrun 01.md 02.md 03.md -o output.pdf\n\nThus `panrun *.md` will work, as long as the YAML is found in the alphabetically first file.\n\nThe input-file doesn't even have to be a markdown file. As long as it starts with a YAML block, it should work.\n\n\n### Defaults and document types\n\nIf you put some YAML in `~/.panrun/default.yaml` (see `panrun -h` for the Windows location), panrun will merge this with the YAML in your input file and add the `--metadata-file` option when calling pandoc. The YAML should be in the same format as always, for example:\n\n    ---\n    author: Always Me\n    output:\n      html:\n        standalone: true\n    ---\n\nFinally, you can e.g. put `type: letter` in the YAML of your input document. In that case, panrun will look for `~/.panrun/letter.yaml` instead of `default.yaml`.\n\n\n## Design\n\n- Panrun should run with no dependencies except pandoc and `ruby \u003e= 2.3.3`, which is the builtin in macOS 10.13.\n- Fortunately, Ruby comes with a YAML parser, which is the same one Jekyll uses.\n- Panrun doesn't hardcode or assume anything about the options. It simply asks your installed pandoc which options it supports (through `pandoc --bash-completion`) and ignores the unknown options in your YAML.\n- The idea is to be somewhat compatible with [rmarkdown's document format](https://bookdown.org/yihui/rmarkdown/output-formats.html). Therefore you can use, for example, either the `html` or `html_document` key (or even `pdf_document` or `slidy_presentation`), or either `toc-depth` or `toc_depth`, and the value of `pandoc_args` is also passed on. (However, as opposed to rmarkdown, panrun doesn't do anything more than passing on the options it finds.) Question: is this useful to anyone, or does this introduce more confusion, since a lot of rmarkdown-options will be silently ignored?\n- If you're looking for more than a simple wrapper script, have a look at [panzer](https://github.com/msprev/panzer) or [pandocomatic](https://github.com/htdebeer/pandocomatic).\n- If you're wondering whether this functionality will soon be part of pandoc itself, the answer is [probably not](https://github.com/jgm/pandoc/issues/4627#issuecomment-422108494).\n- Look at the source, it's really quite minimal! (In the end, I couldn't resist adding another ~40 lines of code for the defaults functionality...)\n- Possible TODOs:\n  - [ ] Expand usage to `panrun [options] input.md [pandoc-options]`, so we could pass the target format to panrun without worrying about it having the same name as a pandoc format. For example, `panrun -t html_pdf input.md` could look for the `html_pdf` key in the `output` field in the YAML.\n  - [ ] Tests\n  - [ ] Look for non-format specific options directly in the `output` mapping?\n\n\n## Installation\n\n1. [Download panrun](https://raw.githubusercontent.com/mb21/panrun/master/panrun)\n2. Place the file somewhere on your `PATH` (e.g. in `/usr/local/bin/`)\n3. Make sure the file has no extension and make it executable. On macOS/Linux (for Windows [read this](https://stackoverflow.com/questions/1422380/)):\n\n       chmod +x ./panrun\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmb21%2Fpanrun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmb21%2Fpanrun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmb21%2Fpanrun/lists"}