{"id":19732625,"url":"https://github.com/mmark-md/mmark-cli","last_synced_at":"2025-04-30T02:32:49.928Z","repository":{"id":28207110,"uuid":"116974101","full_name":"mmark-md/mmark-cli","owner":"mmark-md","description":"Command line interface to the MMark markdown processor","archived":false,"fork":false,"pushed_at":"2025-04-23T18:36:57.000Z","size":96,"stargazers_count":12,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T19:44:55.380Z","etag":null,"topics":["cli","haskell","mmark"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mmark-md.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2018-01-10T15:18:19.000Z","updated_at":"2025-04-23T18:36:54.000Z","dependencies_parsed_at":"2023-12-31T15:28:08.372Z","dependency_job_id":"b266424c-2894-413f-9d83-e74e8394bd51","html_url":"https://github.com/mmark-md/mmark-cli","commit_stats":{"total_commits":86,"total_committers":2,"mean_commits":43.0,"dds":0.05813953488372092,"last_synced_commit":"6461e5241a832f394808398eff264b97acd6b224"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmark-md%2Fmmark-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmark-md%2Fmmark-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmark-md%2Fmmark-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmark-md%2Fmmark-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmark-md","download_url":"https://codeload.github.com/mmark-md/mmark-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251629316,"owners_count":21618143,"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":["cli","haskell","mmark"],"created_at":"2024-11-12T00:27:16.778Z","updated_at":"2025-04-30T02:32:49.922Z","avatar_url":"https://github.com/mmark-md.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MMark CLI\n\n[![License BSD3](https://img.shields.io/badge/license-BSD3-brightgreen.svg)](http://opensource.org/licenses/BSD-3-Clause)\n[![Hackage](https://img.shields.io/hackage/v/mmark-cli.svg?style=flat)](https://hackage.haskell.org/package/mmark-cli)\n[![Stackage Nightly](http://stackage.org/package/mmark-cli/badge/nightly)](http://stackage.org/nightly/package/mmark-cli)\n[![Stackage LTS](http://stackage.org/package/mmark-cli/badge/lts)](http://stackage.org/lts/package/mmark-cli)\n[![CI](https://github.com/mmark-md/mmark-cli/actions/workflows/ci.yaml/badge.svg)](https://github.com/mmark-md/mmark-cli/actions/workflows/ci.yaml)\n\n* [Templates](#templates)\n* [Extensions](#extensions)\n  * [Comment paragraph](#comment-paragraph)\n  * [Font Awesome](#font-awesome)\n  * [Footnotes](#footnotes)\n  * [Kbd tags](#kbd-tags)\n  * [Link targets](#link-targets)\n  * [MathJax](#mathjax)\n  * [Email obfuscation](#email-obfuscation)\n  * [Punctuation prettifier](#punctuation-prettifier)\n  * [GHC syntax highlighter](#ghc-syntax-highlighter)\n  * [Skylighting](#skylighting)\n  * [Table of contents](#table-of-contents)\n* [Contribution](#contribution)\n* [License](#license)\n\nThis is a command line application serving as an interface to the MMark\nmarkdown processor.\n\n```\nmmark—command line interface to MMark markdown processor\n\nUsage: mmark [-v|--version] [-i|--ifile IFILE] [-o|--ofile OFILE] [-j|--json]\n             [-t|--template FILE] [--ext-comment PREFIX] [--ext-font-awesome]\n             [--ext-footnotes] [--ext-kbd] [--ext-link-target] [--ext-mathjax]\n             [--ext-obfuscate-email CLASS] [--ext-punctuation]\n             [--ext-skylighting] [--ext-toc RANGE]\n  Command line interface to MMark markdown processor\n\nAvailable options:\n  -h,--help                Show this help text\n  -v,--version             Print version of the program\n  -i,--ifile IFILE         Read markdown source from this file (otherwise read\n                           from stdin)\n  -o,--ofile OFILE         Save rendered HTML document to this file (otherwise\n                           write to stdout)\n  -j,--json                Output parse errors and result in JSON format\n  -t,--template FILE       Use the template located at this path\n  --ext-comment PREFIX     Remove paragraphs that start with the given prefix\n  --ext-font-awesome       Enable support for inserting font awesome icons\n  --ext-footnotes          Enable support for footnotes\n  --ext-kbd                Enable support for wrapping things in kbd tags\n  --ext-link-target        Enable support for specifying link targets\n  --ext-mathjax            Enable support for MathJax formulas\n  --ext-obfuscate-email CLASS\n                           Obfuscate email addresses assigning the specified\n                           class\n  --ext-punctuation        Enable punctuation prettifier\n  --ext-skylighting        Enable syntax highlighting of code snippets with\n                           Skylighting\n  --ext-toc RANGE          Enable generation of table of contents using the\n                           supplied range of headers to include, e.g. \"1-6\" or\n                           \"2-4\"\n```\n\n## Templates\n\nBy using the `--template` argument, it's possible to create a standalone\nHTML page. The templating system we use is\n[Mustache](https://mustache.github.io/mustache.5.html), as implemented by\nthe [stache](https://hackage.haskell.org/package/stache) library. The\nlibrary conforms to the version 1.1.3 of the official [Mustache\nspecification](https://github.com/mustache/spec), but does not implement\nlambdas (which is an optional feature is the specification) for simplify and\nother technical reasons we won't touch here.\n\nIf markdown source file has a YAML section, its contents will be provided as\ncontext for rendering of the template. In addition to that, a new top-level\nvalue bound to the variable named `output` will be available. That variable\ncontains the HTML rendition of markdown document. It's best to interpolate\nit without HTML escaping, like so: `{{\u0026 output }}`.\n\n## Extensions\n\nHere we list how to use the available extensions. The extensions come from\nthe [`mmark-ext`](https://hackage.haskell.org/package/mmark-ext) package.\n\n### Comment paragraph\n\n* Option: `--ext-comment PREFIX`\n\nThis extension removes paragraphs that start with the given `PREFIX`. For\nexample:\n\n```\n$ mmark --ext-comment REM\nFirst.\n\nREM Second.\n\nThird.\n----------------------- Control-D\n\u003cp\u003eFirst.\u003c/p\u003e\n\u003cp\u003eThird.\u003c/p\u003e\n```\n\n### Font awesome\n\n* Option: `--ext-font-awesome`\n\nThis allows us to turn autolinks with `fa` scheme into font awesome icons:\n\n```\n$ mmark --ext-font-awesome\nHere is the user icon: \u003cfa:user\u003e.\n\nA more interesting example: \u003cfa:quote-left/3x/pull-left/border\u003e.\n----------------------- Control-D\n\u003cp\u003eHere is the user icon: \u003cspan class=\"fa fa-user\"\u003e\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eA more interesting example:\n  \u003cspan class=\"fa fa-quote-left fa-3x fa-pull-left fa-border\"\u003e\u003c/span\u003e.\n\u003c/p\u003e\n```\n\nIn general, all path components in URIs that go after the name of icon will\nbe prefixed with `\"fa-\"` and added as classes, so you can do a lot of fancy\nstuff, see http://fontawesome.io/examples/.\n\n### Footnotes\n\n* Option: `--ext-footnotes`\n\nThe extension performs two transformations:\n\n* It turns links with URIs with `footnote` scheme and single path piece\n  consisting of a number into links to footnote references.\n* It turns block quotes with the `\"footnotes\"` label (see the example below)\n  into a footnote section.\n\n```\n$ mmark --ext-footnotes\nHere goes some text [1](footnote:1).\n\n\u003e footnotes\n\n  1. Here we have the footnote.\n----------------------- Control-D\n\u003cp\u003eHere goes some text \u003ca href=\"#fn1\" id=\"fnref1\"\u003e\u003csup\u003e1\u003c/sup\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003col\u003e\n\u003cli id=\"fn1\"\u003e\nHere we have the footnote.\n\u003ca href=\"#fnref1\"\u003e↩\u003c/a\u003e\u003c/li\u003e\n\u003c/ol\u003e\n```\n\nThe extension is not fully safe though in the sense that we can't check that\na footnote reference refers to an existing footnote and that footnotes have\ncorresponding references, or that they are present in the document in the\nright order.\n\n### Kbd tags\n\n* Option: `--ext-kbd`\n\nIntroduce kbd tags into resulting HTML document by wrapping content in links\nwith URL with `kbd` scheme. For example:\n\n```\n$ mmark --ext-kbd\nTo enable that mode press [Ctrl+A][kbd].\n\n[kbd]: kbd:\n----------------------- Control-D\n\u003cp\u003eTo enable that mode press \u003ckbd\u003eCtrl+A\u003c/kbd\u003e.\u003c/p\u003e\n```\n\nThe use of reference-style links seems more aesthetically pleasant to the\nauthor, but you can of course do something like this instead:\n\n```\nTo enable that mode press [Ctrl+A](kbd:).\n```\n\n### Link targets\n\n* Option: `--ext-link-target`\n\nWhen title of a link starts with the word `\"_blank\"`, `\"_self\"`,\n`\"_parent\"`, or `\"_top\"`, it's stripped from title (as well as all\nwhitespace after it) and added as the value of `target` attribute of the\nresulting link. For example:\n\n```\n$ mmark --ext-kbd\nThis [link](/url '_blank My title') opens in new tab.\n----------------------- Control-D\n\u003cp\u003eThis \u003ca href=\"/url\" title=\"My title\" target=\"_blank\"\u003elink\u003c/a\u003e\nopens in new tab.\u003c/p\u003e\n```\n\n### MathJax\n\n* Option: `--ext-mathjax`\n\nThe extension allows us to transform inline code spans into MathJax inline\nspans and code blocks with the info string `\"mathjax\"` (case-sensitive) into\nMathJax display spans. Every line in such a code block will produce a\nseparate display span, i.e. a separate line with a formula (which is\nprobably what you want anyway).\n\nInline code spans must start and end with the dollar sign `$` to be\nrecognized as MathJax markup:\n\n````\n$ mmark --ext-mathjax\nLet's talk about `$A$` and `$B$`.\n\n```mathjax\nA \\xrightarrow{f} B\n```\n----------------------- Control-D\n\u003cp\u003eLet\u0026#39;s talk about\n  \u003cspan class=\"math inline\"\u003e\\(A\\)\u003c/span\u003e and\n  \u003cspan class=\"math inline\"\u003e\\(B\\)\u003c/span\u003e.\n\u003c/p\u003e\n\u003cp\u003e\n  \u003cspan class=\"math display\"\u003e\\[A \\xrightarrow{f} B\\]\u003c/span\u003e\n\u003c/p\u003e\n````\n\n### Email obfuscation\n\n* Option: `--obfuscate-email CLASS`\n\nThis extension makes email addresses in autolinks be rendered as something\nlike this:\n\n```\n[mark@arch ~]$ mmark --ext-obfuscate-email protected-email\nSend all your spam to \u003csomeone@example.org\u003e, if you can!\n----------------------- Control-D\n\u003cp\u003eSend all your spam to\n  \u003ca href=\"javascript:void(0)\"\n     class=\"protected-email\"\n     data-email=\"someone@example.org\"\u003e\n  Enable JavaScript to see this email\u003c/a\u003e, if you can!\n\u003c/p\u003e\n```\n\nYou'll also need to include jQuery and this bit of JS code for the magic to\nwork:\n\n```java-script\n$(document).ready(function () {\n    $(\".protected-email\").each(function () {\n        var item = $(this);\n        var email = item.data('email');\n        item.attr('href', 'mailto:' + email);\n        item.html(email);\n    });\n});\n```\n\n### Punctuation prettifier\n\n* Option: `--ext-punctuation`\n\nThis makes MMark prettify punctuation (only affects plain text in inlines),\nthe effect is the following:\n\n* Replace `...` with ellipsis `…`\n* Replace `---` with em-dash `—`\n* Replace `--` with en-dash `–`\n* Replace `\"` with left double quote `“` when previous character was a space\n  character, otherwise replace it with right double quote `”`\n* Replace `'` with left single quote `‘` when previous character was a space\n  character, otherwise replace it with right single quote `’` aka apostrophe\n\nFor example (not sure if this is the correct punctuation to use here, but it\ndemonstrates the effect):\n\n```\n$ mmark --ext-punctuation\nSomething---we don't know what, happened...\n----------------------- Control-D\n\u003cp\u003eSomething—we don’t know what, happened…\u003c/p\u003e\n```\n\n### GHC syntax highlighter\n\n* Option: `--ext-ghc-highlighter`\n\nUse the [GHC syntax\nhighlighter](https://hackage.haskell.org/package/ghc-syntax-highlighter)\npackage to highlight code blocks with `\"haskell\"` info string using lexer of\nGHC itself.\n\nThe resulting HTML will be rendered as described\n[here](https://hackage.haskell.org/package/mmark-ext/docs/Text-MMark-Extension-GhcSyntaxHighlighter.html#v:ghcSyntaxHighlighter).\n\nExample:\n\n````\n$ mmark --ext-ghc-highlighter\nSome Haskell:\n\n```haskell\nmain :: IO ()\nmain = return ()\n```\n----------------------- Control-D\n\u003cp\u003eSome Haskell:\u003c/p\u003e\n\u003cdiv class=\"source-code\"\u003e\u003cpre\u003e\u003ccode class=\"language-haskell\"\u003e\n\u003cspan class=\"va\"\u003emain\u003c/span\u003e\u003cspan\u003e \u003c/span\u003e\u003cspan class=\"sy\"\u003e::\u003c/span\u003e\u003cspan\u003e \u003c/span\u003e\u003cspan class=\"cr\"\u003eIO\u003c/span\u003e\u003cspan\u003e \u003c/span\u003e\u003cspan class=\"sy\"\u003e(\u003c/span\u003e\u003cspan class=\"sy\"\u003e)\u003c/span\u003e\u003cspan\u003e\n\u003c/span\u003e\u003cspan class=\"va\"\u003emain\u003c/span\u003e\u003cspan\u003e \u003c/span\u003e\u003cspan class=\"sy\"\u003e=\u003c/span\u003e\u003cspan\u003e \u003c/span\u003e\u003cspan class=\"va\"\u003ereturn\u003c/span\u003e\u003cspan\u003e \u003c/span\u003e\u003cspan class=\"sy\"\u003e(\u003c/span\u003e\u003cspan class=\"sy\"\u003e)\u003c/span\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n````\n\n### Skylighting\n\n* Option: `--ext-skylighting`\n\nUse the [skylighting](https://hackage.haskell.org/package/skylighting)\npackage to render code blocks with info strings that result in a successful\nlookup from the syntax table that comes with the library.\n\nThe resulting HTML will be rendered as described\n[here](https://hackage.haskell.org/package/mmark-ext/docs/Text-MMark-Extension-Skylighting.html#v:skylighting).\n\nExample:\n\n````\n$ mmark --ext-skylighting\nSome Haskell:\n\n```haskell\nmain :: IO ()\nmain = return ()\n```\n----------------------- Control-D\n\u003cp\u003eSome Haskell:\u003c/p\u003e\n\u003cdiv class=\"source-code\"\u003e\u003cpre\u003e\u003ccode class=\"language-haskell\"\u003e\n\u003cspan class=\"ot\"\u003emain ::\u003c/span\u003e\u003cspan\u003e \u003c/span\u003e\u003cspan class=\"dt\"\u003eIO\u003c/span\u003e\u003cspan\u003e ()\u003c/span\u003e\n\u003cspan\u003emain \u003c/span\u003e\u003cspan class=\"fu\"\u003e=\u003c/span\u003e\u003cspan\u003e return ()\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n````\n\n### Table of contents\n\n* Option: `--ext-toc RANGE`\n\nReplace the code block with info string `\"toc\"` by table of contents\nassembled from headings with levels from `N` to `M`, where `N-M` is `RANGE`.\n\nFor example:\n\n````\n$ mmark --ext-toc 2-4\n# Story of my life\n\n```toc\n```\n\n## Charpter 1\n\nFoo.\n\n## Chapter 2\n\nBar.\n\n### Something\n\nBaz.\n----------------------- Control-D\n\u003ch1 id=\"story-of-my-life\"\u003eStory of my life\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003ca href=\"#charpter-1\"\u003eCharpter 1\u003c/a\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003ca href=\"#chapter-2\"\u003eChapter 2\u003c/a\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003ca href=\"#something\"\u003eSomething\u003c/a\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"charpter-1\"\u003eCharpter 1\u003c/h2\u003e\n\u003cp\u003eFoo.\u003c/p\u003e\n\u003ch2 id=\"chapter-2\"\u003eChapter 2\u003c/h2\u003e\n\u003cp\u003eBar.\u003c/p\u003e\n\u003ch3 id=\"something\"\u003eSomething\u003c/h3\u003e\n\u003cp\u003eBaz.\u003c/p\u003e\n````\n\n## Contribution\n\nIssues, bugs, and questions may be reported in [the GitHub issue tracker for\nthis project](https://github.com/mmark-md/mmark-cli/issues).\n\nPull requests are also welcome.\n\n## License\n\nCopyright © 2018–present Mark Karpov\n\nDistributed under BSD 3 clause license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmark-md%2Fmmark-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmark-md%2Fmmark-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmark-md%2Fmmark-cli/lists"}