grunt-md2html
Version:
Small Grunt MultiTask to convert Markdown files to HTML
494 lines (475 loc) • 52.1 kB
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>grunt-md2html</title>
<style>
/* From extension vscode.markdown-math */
@font-face{font-family:KaTeX_AMS;src:url(fonts/KaTeX_AMS-Regular.woff2) format("woff2"),url(fonts/KaTeX_AMS-Regular.woff) format("woff"),url(fonts/KaTeX_AMS-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Bold.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Regular.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Bold.woff) format("woff"),url(fonts/KaTeX_Fraktur-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Regular.woff) format("woff"),url(fonts/KaTeX_Fraktur-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Bold.woff2) format("woff2"),url(fonts/KaTeX_Main-Bold.woff) format("woff"),url(fonts/KaTeX_Main-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Main-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Main-BoldItalic.ttf) format("truetype");font-weight:700;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Italic.woff2) format("woff2"),url(fonts/KaTeX_Main-Italic.woff) format("woff"),url(fonts/KaTeX_Main-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Regular.woff2) format("woff2"),url(fonts/KaTeX_Main-Regular.woff) format("woff"),url(fonts/KaTeX_Main-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Math-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Math-BoldItalic.ttf) format("truetype");font-weight:700;font-style:italic}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-Italic.woff2) format("woff2"),url(fonts/KaTeX_Math-Italic.woff) format("woff"),url(fonts/KaTeX_Math-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Bold.woff) format("woff"),url(fonts/KaTeX_SansSerif-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Italic.woff) format("woff"),url(fonts/KaTeX_SansSerif-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Regular.woff) format("woff"),url(fonts/KaTeX_SansSerif-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Script;src:url(fonts/KaTeX_Script-Regular.woff2) format("woff2"),url(fonts/KaTeX_Script-Regular.woff) format("woff"),url(fonts/KaTeX_Script-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size1;src:url(fonts/KaTeX_Size1-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size1-Regular.woff) format("woff"),url(fonts/KaTeX_Size1-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size2;src:url(fonts/KaTeX_Size2-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size2-Regular.woff) format("woff"),url(fonts/KaTeX_Size2-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size3;src:url(fonts/KaTeX_Size3-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size3-Regular.woff) format("woff"),url(fonts/KaTeX_Size3-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size4;src:url(fonts/KaTeX_Size4-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size4-Regular.woff) format("woff"),url(fonts/KaTeX_Size4-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Typewriter;src:url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2"),url(fonts/KaTeX_Typewriter-Regular.woff) format("woff"),url(fonts/KaTeX_Typewriter-Regular.ttf) format("truetype");font-weight:400;font-style:normal}.katex{font:normal 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto;border-color:currentColor}.katex *{-ms-high-contrast-adjust:none!important}.katex .katex-version:after{content:"0.13.0"}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-webkit-min-content;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-weight:700;font-style:italic}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{display:inline-table;table-layout:fixed;border-collapse:collapse}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;vertical-align:bottom;position:relative}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;vertical-align:bottom;font-size:1px;width:2px;min-width:2px}.katex .vbox{display:inline-flex;flex-direction:column;align-items:baseline}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{width:0;max-width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{width:0;position:relative}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{display:inline-block;border:0 solid;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline{display:inline-block;width:100%;border-bottom-style:dashed}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.83333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.16666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.66666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.45666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.14666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.85714286em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.46857143em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.96285714em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.55428571em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.66666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.77777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.88888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.30444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.76444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.58333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.66666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72833333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.07333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.41666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.48611111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.55555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.44027778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.72777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.28935185em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.34722222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.40509259em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.46296296em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.52083333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20023148em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.43981481em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.24108004em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.28929605em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.33751205em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.38572806em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.43394407em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48216008em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57859209em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69431051em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.83317261em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.19961427em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.20096463em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.24115756em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.28135048em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.32154341em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.36173633em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.40192926em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.48231511em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.57877814em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.69453376em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.83360129em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{display:block;position:absolute;width:100%;height:inherit;fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex svg path{stroke:none}.katex img{border-style:none;min-width:0;min-height:0;max-width:none;max-height:none}.katex .stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{position:absolute;left:0;width:50.2%;overflow:hidden}.katex .halfarrow-right{position:absolute;right:0;width:50.2%;overflow:hidden}.katex .brace-left{position:absolute;left:0;width:25.1%;overflow:hidden}.katex .brace-center{position:absolute;left:25%;width:50%;overflow:hidden}.katex .brace-right{position:absolute;right:0;width:25.1%;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{box-sizing:border-content;border-top:.049em solid;border-right:.049em solid;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{counter-increment:katexEqnNo;content:"(" counter(katexEqnNo) ")"}.katex .mml-eqn-num:before{counter-increment:mmlEqnNo;content:"(" counter(mmlEqnNo) ")"}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;position:absolute;left:calc(50% + .3em);text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left;padding-left:2em}body{counter-reset:katexEqnNo mmlEqnNo}
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.katex-error {
color: var(--vscode-editorError-foreground);
}
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/markdown.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/highlight.css">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif;
font-size: 14px;
line-height: 1.6;
}
</style>
<style>
.task-list-item { list-style-type: none; } .task-list-item-checkbox { margin-left: -20px; vertical-align: middle; }
</style>
<script src="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.js"></script>
</head>
<body class="vscode-body vscode-light">
<p><img src="https://github.com/bylexus/grunt-md2html/workflows/grunt-md2html%20tests/badge.svg?branch=master" alt="Build Status"></p>
<h1 id="grunt-md2html">grunt-md2html</h1>
<p>Small Grunt MultiTask based on the nodejs package <a href="https://github.com/chjj/marked">marked</a> to convert Markdown files to HTML.</p>
<p><strong>Note:</strong> Since version 0.6.0, this Grunt MultiTask needs <code>nodejs >= 12</code> and <code>grunt >= 1.0.0</code>.</p>
<ul>
<li>Takes input Markdown-Files</li>
<li>process them using the grunt-internal template engine (lodash)</li>
<li>converts them to HTML either one-by-one or many-to-one</li>
<li>optionally highlight code parts using highligh.js with optional style string</li>
<li>Supports embedded <a href="https://plantuml.com/"> PlantUML </a> to directly render images from PlantUML Code</li>
</ul>
<h2 id="table-of-contents">Table of Contents</h2>
<ul>
<li><a href="#table-of-contents">Table of Contents</a></li>
<li><a href="#getting-started">Getting Started</a></li>
<li><a href="#the-md2html-task">The "md2html" task</a>
<ul>
<li><a href="#overview">Overview</a></li>
<li><a href="#options">Options</a>
<ul>
<li><a href="#optionslayout">options.layout</a></li>
<li><a href="#optionsbasepath">options.basePath</a></li>
<li><a href="#optionsmarkedoptions">options.markedOptions</a></li>
<li><a href="#optionstemplatedata">options.templateData</a></li>
<li><a href="#optionsseparator">options.separator</a></li>
</ul>
</li>
<li><a href="#template-variables">Template variables</a>
<ul>
<li><a href="#optionshighlightjs">options.highlightjs</a></li>
<li><a href="#optionsplantuml">options.plantuml</a></li>
</ul>
</li>
<li><a href="#usage-examples">Usage Examples</a>
<ul>
<li><a href="#single-html-file-output">Single HTML file output</a></li>
<li><a href="#one-html-file-per-md-file-output">One HTML file per md file output</a></li>
<li><a href="#options-example">Options example</a></li>
<li><a href="#template-example-including-highlighjs">Template example, including highlighjs</a>
<ul>
<li><a href="#grunt-config">grunt config</a></li>
<li><a href="#template-md-file">Template .md file</a></li>
</ul>
</li>
<li><a href="#include-other-md-files-from-within-md">Include other .md files from within .md</a>
<ul>
<li><a href="#example-the-main-file-with-a-toc">Example: The main file with a TOC</a></li>
<li><a href="#the-separate-toc-file">The separate TOC file</a></li>
<li><a href="#use-_-in-your-included-file-names-to-filter-them-from-output-creation">Use '_' in your included file names to filter them from output creation</a></li>
</ul>
</li>
<li><a href="#plantuml-example">PlantUML example</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#release-history">Release History</a></li>
<li><a href="#license">License</a></li>
</ul>
<h2 id="getting-started">Getting Started</h2>
<p>This plugin requires Grunt <code>^1.0.0</code></p>
<p>If you haven't used <a href="http://gruntjs.com/">Grunt</a> before, be sure to check out the <a href="http://gruntjs.com/getting-started">Getting Started</a> guide, as it explains how to create a <a href="http://gruntjs.com/sample-gruntfile">Gruntfile</a> as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:</p>
<pre><code class="language-shell"><div>npm install grunt-md2html --save-dev
</div></code></pre>
<p>One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:</p>
<pre><code class="language-js"><div>grunt.loadNpmTasks(<span class="hljs-string">'grunt-md2html'</span>);
</div></code></pre>
<h2 id="the-md2html-task">The "md2html" task</h2>
<h3 id="overview">Overview</h3>
<p>In your project's Gruntfile, add a section named <code>md2html</code> to the data object passed into <code>grunt.initConfig()</code>.</p>
<pre><code class="language-js"><div>grunt.initConfig({
<span class="hljs-attr">md2html</span>: {
<span class="hljs-attr">options</span>: {
<span class="hljs-comment">// Task-specific options go here.</span>
},
<span class="hljs-attr">your_target</span>: {
<span class="hljs-comment">// Target-specific file lists and/or options go here.</span>
},
},
})
</div></code></pre>
<h3 id="options">Options</h3>
<h4 id="optionslayout">options.layout</h4>
<p>Type: <code>String</code>
Default value: <code>null</code></p>
<p>A path to a layout file: A Layout file defines the global surrounding layout,
e.g. an HTML header / footer. Within the Layout file you can then include the
actual processed .md-file content.</p>
<p>Example layout file:</p>
<pre><code><code><div><!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<%= basepath %>/style.css">
<title></title>
</head>
<body>
<%= document %>
</body>
</html>
</div></code></code></pre>
<p>This layout file adds an HTML skeleton around each processed output file, replacing the template
strings <code>basepath</code> and <code>document </code> (the processed content).</p>
<h4 id="optionsbasepath">options.basePath</h4>
<p>Type: <code>String</code>
Default value: <code>null</code></p>
<p>If basePath is set, you can use <code><%= basepath %></code> in your .md / layout file, which is expanded
to a relative path from the actual output file to the given basePath. Useful to link
static resources like stylesheets in the layout file</p>
<h4 id="optionsmarkedoptions">options.markedOptions</h4>
<p>Type: <code>Object</code>
Default value: <code>{}</code></p>
<p>Options to be set on the <code>marked</code> package, see <a href="https://github.com/chjj/marked">https://github.com/chjj/marked</a> for details. E.g.:</p>
<pre><code><code><div>markedOptions: {
gfm: false
}
</div></code></code></pre>
<p>disables the GIT flavored markdown.</p>
<h4 id="optionstemplatedata">options.templateData</h4>
<p>Type: <code>Object</code>
Default value: <code>{}</code></p>
<p>Additional data which is passed to the template engine before the .md file is processed.
The data object's content is directly available as template vars / functions. See Usage Examples
for more information.</p>
<h4 id="optionsseparator">options.separator</h4>
<p>Type: <code>String</code>
Default value: <code>'\n\n'</code></p>
<p>A string value that is used to concatenate the .md files if used in one-outputfile mode</p>
<h3 id="template-variables">Template variables</h3>
<p>Each markdown file is first processed by the Grunt-internal Template Engine (see <a href="http://gruntjs.com/api/grunt.template">http://gruntjs.com/api/grunt.template</a>). In addition to the grunt-own template variables and functions, you can use the following
variables which are replaced BEFORE processing the MD file:</p>
<ul>
<li><code>document</code>: Contains the processed HTML code for a destination file. Useful for a Layout file. (For backward compatibility: use <code>{DOC}</code>).<br />
<strong>Note:</strong> <code>document</code> is ONLY available in a layout file, not in a single source .md file.</li>
<li><code>basepath</code>: Points relatively to the <code>dest</code> path of the actual output, or to the given basePath in the options. (For backward compatibility: use <code>{BASEPATH}</code>)</li>
<li><code>destination</code>: The relative path to the actual destination file. (For backward compatibility: use <code>{DEST}</code>)</li>
<li><code>src</code>: The original .md source file in which the variable occurs. <strong>NOTE:</strong> In a layout file (see below), this variable is an array: The grunt job can concat multiple files into one destination file.</li>
</ul>
<p><code>src</code> needs to be treatened differently for source files and layout files:</p>
<ul>
<li>in a source .md file, <code>src</code> is the path (string) to the original .md file</li>
<li>in a layout file, <code>src</code> is an array: A grunt job can concat multiple files into
one destination, in a grunt files config like this:</li>
</ul>
<pre><code class="language-js"><div><span class="hljs-comment">// Gruntfile.js</span>
<span class="hljs-built_in">module</span>.exports = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">grunt</span>) </span>{
grunt.initConfig({
<span class="hljs-attr">md2html</span>: {
<span class="hljs-string">'multifiles'</span>: {
<span class="hljs-attr">options</span>: {
<span class="hljs-attr">layout</span>: <span class="hljs-string">'layout.html'</span>,
},
<span class="hljs-attr">files</span>: [
{
<span class="hljs-comment">// multiple file to 1 dest:</span>
<span class="hljs-attr">src</span>: [<span class="hljs-string">'multi_1.md'</span>, <span class="hljs-string">'multi_2.md'</span>],
<span class="hljs-attr">dest</span>: <span class="hljs-string">'output.html'</span>
}
]
}
}
});
};
</div></code></pre>
<p>So make sure to use <code>src</code> appropriately:</p>
<pre><code><code><div>// multi_1.md:
Source file: <%= src %>
</div></code></code></pre>
<pre><code><code><div>// layout.html:
Source files:
<% src.forEach(function(f){ %>
- <%= f %>
<% }) %>
</div></code></code></pre>
<h4 id="optionshighlightjs">options.highlightjs</h4>
<p>Type: <code>Object</code>
Default value:</p>
<pre><code><code><div>options.highlightjs: {
enabled: false, // disabled by default
style: 'monokai', // highlightjs default theme (theme file name without .css)
compressStyle: true, // minified version of the string based style sheet
options: {} // options for the highlightjs constructor
}
</div></code></code></pre>
<p>md2html includes <a href="https://highlightjs.org/">highlightjs</a> if you want to highlight source code in the markdown file.
Code blocks then are enriched by highlightjs with HTML and style elements: The HTML is parsed and code blocks are sent through highlightjs before writing the final HTML.</p>
<p>Enable code highlighting / highlightjs tags by setting <code>enabled</code> to true.</p>
<p>To style the enriched code blocks, you have to include an official highlightjs CSS file:</p>
<p>You have two options for adding highlightjs styling / theming:</p>
<ol>
<li>Include a highlightjs CSS file in your layout manually (see example <a href="https://highlightjs.org/download/">here</a> )</li>
<li>Use the stringified CSS version in your template: grunt-md2html reads the original highlightjs
style sheet as CSS string, and allows you to use it directly in your markdown file by outputting
the template variable <code>highlightjs_style</code>:</li>
</ol>
<pre><code><code><div><style>
<%= highlightjs_style %>
</style>
</div></code></code></pre>
<p>An example:</p>
<pre><code class="language-html"><div><span class="hljs-comment"><!-- layout HTML file --></span>
<span class="hljs-meta"><!DOCTYPE <span class="hljs-meta-keyword">html</span>></span>
<span class="hljs-tag"><<span class="hljs-name">html</span>></span>
<span class="hljs-tag"><<span class="hljs-name">head</span>></span>
<span class="hljs-tag"><<span class="hljs-name">style</span>></span><span class="xml">
<span class="hljs-tag"><<span class="hljs-name">%=</span> <span class="hljs-attr">highlightjs_style</span> %></span>
</span><span class="hljs-tag"></<span class="hljs-name">style</span>></span>
<span class="hljs-tag"></<span class="hljs-name">head</span>></span>
<span class="hljs-tag"><<span class="hljs-name">body</span>></span>
<span class="hljs-tag"><<span class="hljs-name">%=</span> <span class="hljs-attr">document</span> %></span>
<span class="hljs-tag"></<span class="hljs-name">body</span>></span>
<span class="hljs-tag"></<span class="hljs-name">html</span>></span>
</div></code></pre>
<h1 id="precodemarkdown-file-with-code-snippet"><pre><code>
Markdown file with code snippet:</h1>
<p>Now follows some javascript code:</p>
<pre><code><code><div>var f = function(var1) {
console.log(var1);
}
</div></code></code></pre>
<p></code></pre></p>
<h4 id="optionsplantuml">options.plantuml</h4>
<ul>
<li>Type: <code>Object</code></li>
<li>Default value: null</li>
<li>Available configs:</li>
</ul>
<pre><code><code><div>options.plantuml: {
// Local run:
// Full execution command of PlantUML, without options:
exec: 'java -jar plantuml.jar'
// Remote run:
// Provide the base URL for the PlantUML Render Servlet:
renderServerUrl: "http://www.plantuml.com/plantuml"
}
</div></code></code></pre>
<p>Either <strong>exec</strong> or <strong>renderServerUrl</strong> is needed:</p>
<ul>
<li>If you have a local plantuml binary / JAR file, provide the full execution command in the <code>exec</code>property.
The command is appended with PlantUML options, e.g. <code>java -jar plantuml.jar -tpng inputfile.html</code></li>
<li>If you want to use a remote PlantUML render server (see <a href="https://plantuml.com/server">https://plantuml.com/server</a>), provide the base URL for the render service
with the <code>renderServerUrl</code> property. The diagram code is URL-encoded and appended to the URL, for example:
<a href="http://www.plantuml.com/plantuml/png/UDehoIp9ILNmhLG8o4dCAmdrzL5moKnCBqhCvKhEIImkLaZBprUevb80WgJ48Yk5u9AYpBnqhbe031uI8G00%60">http://www.plantuml.com/plantuml/png/UDehoIp9ILNmhLG8o4dCAmdrzL5moKnCBqhCvKhEIImkLaZBprUevb80WgJ48Yk5u9AYpBnqhbe031uI8G00`</a></li>
</ul>
<h3 id="usage-examples">Usage Examples</h3>
<h4 id="single-html-file-output">Single HTML file output</h4>
<p>In this example, all found .md files are converted to HTML and ONE html output file is generated:</p>
<pre><code class="language-js"><div>grunt.initConfig({
<span class="hljs-attr">md2html</span>: {
<span class="hljs-attr">one_file</span>: {
<span class="hljs-attr">options</span>: {},
<span class="hljs-attr">files</span>: [{
<span class="hljs-attr">src</span>: [<span class="hljs-string">'my/md/files/**/*.md'</span>],
<span class="hljs-attr">dest</span>: <span class="hljs-string">'out/output.html'</span>
}]
}
}
})
</div></code></pre>
<h4 id="one-html-file-per-md-file-output">One HTML file per md file output</h4>
<p>In this example, all found .md files are converted to an HTML file in the same directory.
Note that this is a base functionality of grunt's file expanding facility:</p>
<pre><code class="language-js"><div>grunt.initConfig({
<span class="hljs-attr">md2html</span>: {
<span class="hljs-attr">multiple_files</span>: {
<span class="hljs-attr">options</span>: {},
<span class="hljs-attr">files</span>: [{
<span class="hljs-attr">expand</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">cwd</span>: <span class="hljs-string">'base/path/to/md/files'</span>,
<span class="hljs-attr">src</span>: [<span class="hljs-string">'**/*.md'</span>],
<span class="hljs-attr">dest</span>: <span class="hljs-string">'output'</span>,
<span class="hljs-attr">ext</span>: <span class="hljs-string">'.html'</span>
}]
}
}
});
</div></code></pre>
<h4 id="options-example">Options example</h4>
<p>This example just demonstrates the different options:</p>
<ul>
<li>layout: A layout file used for each processed output file</li>
<li>basePath: The <code><%= basepath %></code> template variable which can be used within the docs points relatively to the basePath</li>
<li>separator: concatenator string when using multiple md files which go to one output file</li>
</ul>
<pre><code class="language-js"><div>grunt.initConfig({
<span class="hljs-attr">md2html</span>: {
<span class="hljs-attr">multiple_files</span>: {
<span class="hljs-attr">options</span>: {
<span class="hljs-attr">layout</span>: <span class="hljs-string">'path/to/layout.html'</span>,
<span class="hljs-attr">basePath</span>: <span class="hljs-string">'path/to'</span>,
<span class="hljs-attr">markedOptions</span>: {
<span class="hljs-attr">gfm</span>: <span class="hljs-literal">false</span>,
<span class="hljs-attr">langPrefix</span>: <span class="hljs-string">'code-'</span>
}
},
<span class="hljs-attr">files</span>: [{
<span class="hljs-attr">expand</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">cwd</span>: <span class="hljs-string">'base/path/to/md/files'</span>,
<span class="hljs-attr">src</span>: [<span class="hljs-string">'**/*.md'</span>],
<span class="hljs-attr">dest</span>: <span class="hljs-string">'output'</span>,
<span class="hljs-attr">ext</span>: <span class="hljs-string">'.html'</span>
}]
}
}
});
</div></code></pre>
<h4 id="template-example-including-highlighjs">Template example, including highlighjs</h4>
<p>This example demonstrates the usage of the pre-processing Template engine which can be used
to process arbitary javascript variable / functions. It also demonstrates code
highlighting using highlightjs:</p>
<h5 id="grunt-config">grunt config</h5>
<pre><code class="language-js"><div>grunt.initConfig({
<span class="hljs-attr">md2html</span>: {
<span class="hljs-attr">multiple_files</span>: {
<span class="hljs-attr">options</span>: {
<span class="hljs-attr">basePath</span>: <span class="hljs-string">'path/to'</span>,
<span class="hljs-comment">// Provide the function `basename` and a variable `author` to the templates</span>
<span class="hljs-attr">templateData</span>: {
<span class="hljs-attr">basename</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">src</span>) </span>{
<span class="hljs-keyword">return</span> src.substr(src.lastIndexOf(path.sep)+<span class="hljs-number">1</span>);
},
<span class="hljs-attr">author</span>: process.env.USER
},
<span class="hljs-attr">highlightjs</span>: {
<span class="hljs-attr">enabled</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">style</span>: <span class="hljs-string">'paraiso.dark'</span>,
<span class="hljs-attr">compressStyle</span>: <span class="hljs-literal">true</span>
},
},
<span class="hljs-attr">files</span>: [{
<span class="hljs-attr">expand</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">cwd</span>: <span class="hljs-string">'base/path/to/md/files'</span>,
<span class="hljs-attr">src</span>: [<span class="hljs-string">'**/*.md'</span>],
<span class="hljs-attr">dest</span>: <span class="hljs-string">'output'</span>,
<span class="hljs-attr">ext</span>: <span class="hljs-string">'.html'</span>
}]
}
}
});
</div></code></pre>
<h5 id="template-md-file">Template .md file</h5>
<pre><code><code><div><style type="text/css"><%= highlightjs_style %></style>
Hello. This is an example written by <%= author %>.
It comes from the file <%= basename(src) %>, and ends in the file <%= destination %>.
Created on <%= grunt.template.today('yyyy-mm-dd HH:MM:ss') %>.
And now some highlighted code:
<pre><code>
var fact = function(f) {
if (f > 1) {
return f * (fact(f-1));
} else return 1;
}
</code></pre>
</div></code></code></pre>
<h4 id="include-other-md-files-from-within-md">Include other .md files from within .md</h4>
<p>You can also include (load) other .md files within your .md files. This makes the generation of a separate TOC file, which is included in each output file, very easy:</p>
<h5 id="example-the-main-file-with-a-toc">Example: The main file with a TOC</h5>
<p>Note that the file path must be relative to your Gruntfile:</p>
<pre><code><code><div>An MD file. Include the TOC here:
<% print(grunt.file.read('gruntfile/rel/path/to/md/file.md')) %>
</div></code></code></pre>
<h5 id="the-separate-toc-file">The separate TOC file</h5>
<pre><code><code><div>Table of contents:
* foo
* bar
</div></code></code></pre>
<p>The output html then looks as follows:</p>
<pre><code><code><div>An MD file. Include the TOC here:
Table of contents:
* foo
* bar
</div></code></code></pre>
<h5 id="use-_-in-your-included-file-names-to-filter-them-from-output-creation">Use '_' in your included file names to filter them from output creation</h5>
<p>If you don't want to have an output file generated for each included file, you can use a file name convention:</p>
<ul>
<li>Start each included filename with a '_'</li>
<li>Use the <code>filter</code> property in the Gruntifle's <code>file</code> definition.</li>
</ul>
<p>Example:</p>
<pre><code class="language-javascript"><div>grunt.initConfig({
<span class="hljs-attr">md2html</span>: {
<span class="hljs-attr">includeTest</span>: {
<span class="hljs-attr">files</span>: [{
<span class="hljs-attr">expand</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">cwd</span>: <span class="hljs-string">'docs'</span>,
<span class="hljs-attr">src</span>: [<span class="hljs-string">'**/*.md'</span>],
<span class="hljs-comment">// Filter away all files that begin with '_':</span>
<span class="hljs-attr">filter</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">src</span>) </span>{
<span class="hljs-keyword">if</span> (path.basename(src)[<span class="hljs-number">0</span>] === <span class="hljs-string">'_'</span>) { <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>; } <span class="hljs-keyword">else</span> { <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>; }
},
<span class="hljs-attr">dest</span>: <span class="hljs-string">'output'</span>,
<span class="hljs-attr">ext</span>: <span class="hljs-string">'.html'</span>
}]
}
});
</div></code></pre>
<h4 id="plantuml-example">PlantUML example</h4>
<p>You can directly embed <a href="https://plantuml.com/">PlantUML</a> code into your markdown/html files:</p>
<pre><code class="language-text"><div><!-- document.md: -->
Markdown with embedded PlantUML
-------------------------------
Here comes my Diagram:
@startuml name-of-image
class Foo {
}
class Bar {
}
Foo <|-- Bar
@enduml
... and another:
@startuml name-of-2nd-image
Bob -> Alice : hello
@enduml
</div></code></pre>
<p>It is important to define the imagename <code>@startuml [imgname]</code>: This will be used as the
image filename (plus ending).</p>
<p>The snippets are then parsed on build time, images are generated and replaced with their
respective image markdown tags:</p>
<pre><code class="language-text"><div><!-- document.md: -->
Markdown with embedded PlantUML
-------------------------------
Here comes my Diagram:

... and another:

</div></code></pre>
<p>The Gruntfile must enable either local or remote PlantUML rendering settings:</p>
<pre><code class="language-js"><div><span class="hljs-comment">// Gruntfile.js:</span>
grunt.initConfig({
<span class="hljs-attr">md2html</span>: {
<span class="hljs-attr">some_diagrams</span>: {
<span class="hljs-attr">options</span>: {
<span class="hljs-attr">plantuml</span>: {
<span class="hljs-comment">// Local plantuml executable:</span>
<span class="hljs-attr">exec</span>: <span class="hljs-string">'/usr/bin/plantuml'</span>,
<span class="hljs-comment">// ... or remote render server:</span>
<span class="hljs-attr">renderServerUrl</span>: <span class="hljs-string">"http://www.plantuml.com/plantuml"</span>
}
},
<span class="hljs-attr">files</span>: [{
<span class="hljs-attr">expand</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">cwd</span>: <span class="hljs-string">'base/path/to/md/files'</span>,
<span class="hljs-attr">src</span>: [<span class="hljs-string">'**/*.md'