diff --git a/public/res/WELCOME.md b/public/res/WELCOME.md index 33ff45bc..4c9f24a9 100644 --- a/public/res/WELCOME.md +++ b/public/res/WELCOME.md @@ -124,19 +124,19 @@ Markdown Extra **Markdown Extra** has a special syntax for tables: -Item | Value ---- | --- +Item | Value +-------- | --- Computer | $1600 -Phone | $12 -Pipe | $1 +Phone | $12 +Pipe | $1 You can specify column alignment with one or two colons: -| Item | Value | Qty | -| :--- | ---: | :---: | -| Computer | $1600 | 5 | -| Phone | $12 | 12 | -| Pipe | $1 | 234 | +| Item | Value | Qty | +| :------- | ----: | :---: | +| Computer | $1600 | 5 | +| Phone | $12 | 12 | +| Pipe | $1 | 234 | ### Definition Lists @@ -185,11 +185,11 @@ You can create footnotes like this[^footnote]. SmartyPants converts ASCII punctuation characters into "smart" typographic punctuation HTML entities. For example: -| | ASCII | HTML | ----|---|--- -| Single backticks | `'Isn't this fun?'` | 'Isn't this fun?' | -| Quotes | `"Isn't this fun?"` | "Isn't this fun?" | -| Dashes | `-- is en-dash, --- is em-dash` | -- is en-dash, --- is em-dash | +| | ASCII | HTML | + ----------------- | ---------------------------- | ------------------ +| Single backticks | `'Isn't this fun?'` | 'Isn't this fun?' | +| Quotes | `"Isn't this fun?"` | "Isn't this fun?" | +| Dashes | `-- is en-dash, --- is em-dash` | -- is en-dash, --- is em-dash | ### Table of contents diff --git a/public/res/libs/prism-markdown.js b/public/res/libs/prism-markdown.js index 19ef7af3..98f20673 100644 --- a/public/res/libs/prism-markdown.js +++ b/public/res/libs/prism-markdown.js @@ -30,7 +30,49 @@ Prism.languages.md = (function() { inside: { } }; - md.hr = { + md.table = { + pattern: new RegExp( + ['^' , + '[ ]{0,3}' , // Allowed whitespace + '[|]' , // Initial pipe + '(.+)\\n' , // $1: Header Row + + '[ ]{0,3}' , // Allowed whitespace + '[|]([ ]*[-:]+[-| :]*)\\n' , // $2: Separator + + '(' , // $3: Table Body + '(?:[ ]*[|].*\\n?)*' , // Table rows + ')', + '(?:\\n|$)' // Stop at final newline + ].join(''), + 'gm' + ), + inside: { + lf: /\n/gm + } + }; + md['table alt'] = { + pattern: new RegExp( + ['^' , + '[ ]{0,3}' , // Allowed whitespace + '(\\S.*[|].*)\\n' , // $1: Header Row + + '[ ]{0,3}' , // Allowed whitespace + '([-:]+[ ]*[|][-| :]*)\\n' , // $2: Separator + + '(' , // $3: Table Body + '(?:.*[|].*\\n?)*' , // Table rows + ')' , + '(?:\\n|$)' // Stop at final newline + ].join(''), + 'gm' + ), + inside: { + lf: /\n/gm + } + }; + + md.hr = { pattern: /^([*\-_] *){3,}$/gm, }; md.li = { @@ -266,6 +308,8 @@ Prism.languages.md = (function() { } md["h1 alt"].inside.rest = rest; md["h2 alt"].inside.rest = rest; + md.table.inside.rest = rest; + md["table alt"].inside.rest = rest; md.p.inside.rest = rest; md.blockquote.inside.rest = rest; md.li.inside.rest = rest; diff --git a/public/res/styles/main.less b/public/res/styles/main.less index bbf20a41..6d7102ae 100644 --- a/public/res/styles/main.less +++ b/public/res/styles/main.less @@ -1173,6 +1173,10 @@ a { color: @tertiary-color; } + .table { + font: normal 0.9em @font-family-monospace; + } + .comment { font-size: 0.9em; color: @tertiary-color-light;