packages feed

mmark-cli 0.0.1.0 → 0.0.2.0

raw patch · 4 files changed

+98/−12 lines, 4 filesdep ~mmark-ext

Dependency ranges changed: mmark-ext

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+## MMark CLI 0.0.2.0++* Added two new extensions: footnotes (`--ext-footnotes`) and MathJax+  support (`--ext-mathjax`).+ ## MMark CLI 0.0.1.0  * Initial release.
README.md view
@@ -10,8 +10,10 @@ * [Extensions](#extensions)   * [Comment paragraph](#comment-paragraph)   * [Font Awesome](#font-awesome)+  * [Footnotes](#footnotes)   * [Kbd tags](#kbd-tags)   * [Link targets](#link-targets)+  * [MathJax](#mathjax)   * [Email obfuscation](#email-obfuscation)   * [Punctuation prettifier](#punctuation-prettifier)   * [Skylighting](#skylighting)@@ -27,8 +29,9 @@  Usage: mmark [-v|--version] [-i|--ifile IFILE] [-o|--ofile OFILE] [-j|--json]              [-t|--template FILE] [--ext-comment PREFIX] [--ext-font-awesome]-             [--ext-kbd] [--ext-link-target] [--ext-obfuscate-email CLASS]-             [--ext-punctuation] [--ext-skylighting] [--ext-toc RANGE]+             [--ext-footnotes] [--ext-kbd] [--ext-link-target] [--ext-mathjax]+             [--ext-obfuscate-email CLASS] [--ext-punctuation]+             [--ext-skylighting] [--ext-toc RANGE]   Command line interface to MMark markdown processor  Available options:@@ -42,8 +45,10 @@   -t,--template FILE       Use the template located at this path   --ext-comment PREFIX     Remove paragraphs that start with the given prefix   --ext-font-awesome       Enable support for inserting font awesome icons+  --ext-footnotes          Enable support for footnotes   --ext-kbd                Enable support for wrapping things in kbd tags   --ext-link-target        Enable support for specifying link targets+  --ext-mathjax            Enable support for MathJax formulas   --ext-obfuscate-email CLASS                            Obfuscate email addresses assigning the specified                            class@@ -116,14 +121,46 @@  In general, all path components in URIs that go after the name of icon will be prefixed with `"fa-"` and added as classes, so you can do a lot of fancy-stuff, see <http://fontawesome.io/examples/>.+stuff, see http://fontawesome.io/examples/. +### Footnotes++* Option: `--ext-footnotes`++The extension performs two transformations:++* It turns links with URIs with `footnote` scheme and single path piece+  consisting of a number into links to footnote references.+* It turns block quotes with the `"footnotes"` label (see the example below)+  into a footnote section.++```+$ mmark --ext-footnotes+Here goes some text [1](footnote:1).++> footnotes++  1. Here we have the footnote.+----------------------- Control-D+<p>Here goes some text <a href="#fn1" id="fnref1"><sup>1</sup></a>.</p>+<ol>+<li id="fn1">+Here we have the footnote.+<a href="#fnref1">↩</a></li>+</ol>+```++The extension is not fully safe though in the sense that we can't check that+a footnote reference refers to an existing footnote and that footnotes have+corresponding references, or that they are present in the document in the+right order.+ ### Kbd tags  * Option: `--ext-kbd`  Introduce kbd tags into resulting HTML document by wrapping content in links-with URL with kbd scheme. For example:+with URL with `kbd` scheme. For example:  ``` $ mmark --ext-kbd@@ -147,7 +184,7 @@  When title of a link starts with the word `"_blank"`, `"_self"`, `"_parent"`, or `"_top"`, it's stripped from title (as well as all-whitespace after it) and added as the value of target attribute of the+whitespace after it) and added as the value of `target` attribute of the resulting link. For example:  ```@@ -158,6 +195,36 @@ opens in new tab.</p> ``` +### MathJax++* Option: `--ext-mathjax`++The extension allows to transform inline code spans into MathJax inline+spans and code blocks with the info string `"mathjax"` (case-sensitive) into+MathJax display spans. Every line in such a code block will produce a+separate display span, i.e. a separate line with a formula (which is+probably what you want anyway).++Inline code spans must start and end with the dollar sign `$` to be+recognized as MathJax markup:++````+$ mmark --ext-mathjax+Let's talk about `$A$` and `$B$`.++```mathjax+A \xrightarrow{f} B+```+----------------------- Control-D+<p>Let&#39;s talk about+  <span class="math inline">\(A\)</span> and+  <span class="math inline">\(B\)</span>.+</p>+<p>+  <span class="math display">\[A \xrightarrow{f} B\]</span>+</p>+````+ ### Email obfuscation  * Option: `--obfuscate-email CLASS`@@ -206,7 +273,7 @@ * Replace `'` with left single quote `‘` when previous character was a space   character, otherwise replace it with right single quote `’` aka apostrophe -For example (not sure this is the correct punctuation to use here, but it+For example (not sure if this is the correct punctuation to use here, but it demonstrates the effect):  ```@@ -222,7 +289,7 @@  Use the [skylighting](https://hackage.haskell.org/package/skylighting) package to render code blocks with info strings that result in a successful-lookup from syntax table that comes with the library.+lookup from the syntax table that comes with the library.  The resulting markup is wrapped with spans as described in the docs for [`formatHtmlInline`](https://hackage.haskell.org/package/skylighting/docs/Skylighting-Format-HTML.html#v:formatHtmlInline).
app/Main.hs view
@@ -57,8 +57,10 @@       let exts = mconcat             [ g optExtComment               Ext.commentParagraph             , f optExtFontAwesome           Ext.fontAwesome+            , f optExtFootnotes             Ext.footnotes             , f optExtKbd                   Ext.kbd             , f optExtLinkTarget            Ext.linkTarget+            , f optExtMathJax               (Ext.mathJax (Just '$'))             , g optExtObfuscateEmail        Ext.obfuscateEmail             , f optExtPunctuationPrettifier Ext.punctuationPrettifier             , f optExtSkylighting           Ext.skylighting defaultFormatOpts@@ -107,10 +109,14 @@     -- ^ Enable extension: 'Ext.commentParagraph'   , optExtFontAwesome :: !Bool     -- ^ Enable extension: 'Ext.fontAwesome'+  , optExtFootnotes :: !Bool+    -- ^ Enable extension: 'Ext.footnotes'   , optExtKbd :: !Bool     -- ^ Enable extension: 'Ext.kbd'   , optExtLinkTarget :: !Bool     -- ^ Enable extension: 'Ext.linkTarget'+  , optExtMathJax :: !Bool+    -- ^ Enable extension: 'Ext.mathJax'   , optExtObfuscateEmail :: !(Maybe Text)     -- ^ Enable extension: 'Ext.obfuscateEmail'   , optExtPunctuationPrettifier :: !Bool@@ -180,12 +186,20 @@     , help    "Enable support for inserting font awesome icons"     ]   <*> (switch . mconcat)+    [ long    "ext-footnotes"+    , help    "Enable support for footnotes"+    ]+  <*> (switch . mconcat)     [ long    "ext-kbd"     , help    "Enable support for wrapping things in kbd tags"     ]   <*> (switch . mconcat)     [ long    "ext-link-target"     , help    "Enable support for specifying link targets"+    ]+  <*> (switch . mconcat)+    [ long    "ext-mathjax"+    , help    "Enable support for MathJax formulas"     ]   <*> (optional . fmap T.pack . strOption . mconcat)     [ long    "ext-obfuscate-email"
mmark-cli.cabal view
@@ -1,5 +1,5 @@ name:                 mmark-cli-version:              0.0.1.0+version:              0.0.2.0 cabal-version:        >= 1.18 tested-with:          GHC==8.0.2, GHC==8.2.2 license:              BSD3@@ -8,10 +8,10 @@ maintainer:           Mark Karpov <markkarpov92@gmail.com> homepage:             https://github.com/mmark-md/mmark-cli bug-reports:          https://github.com/mmark-md/mmark-cli/issues-category:             Categories-synopsis:             Description+category:             Text, CLI+synopsis:             Command line interface to MMark markdown processor build-type:           Simple-description:          Description.+description:          Command line interface to MMark markdown processor. extra-doc-files:      CHANGELOG.md                     , README.md @@ -35,7 +35,7 @@                     , lucid            >= 2.6   && < 3.0                     , megaparsec       >= 6.4   && < 7.0                     , mmark            >= 0.0.4 && < 0.1-                    , mmark-ext        >= 0.1   && < 0.2+                    , mmark-ext        >= 0.1.1 && < 0.2                     , optparse-applicative >= 0.14 && < 0.15                     , skylighting      >= 0.5   && < 0.6                     , stache           >= 1.2   && < 1.3