Added table syntax highlighting
This commit is contained in:
parent
f6c3a0444c
commit
166df577c2
@ -124,19 +124,19 @@ Markdown Extra
|
|||||||
|
|
||||||
**Markdown Extra** has a special syntax for tables:
|
**Markdown Extra** has a special syntax for tables:
|
||||||
|
|
||||||
Item | Value
|
Item | Value
|
||||||
--- | ---
|
-------- | ---
|
||||||
Computer | $1600
|
Computer | $1600
|
||||||
Phone | $12
|
Phone | $12
|
||||||
Pipe | $1
|
Pipe | $1
|
||||||
|
|
||||||
You can specify column alignment with one or two colons:
|
You can specify column alignment with one or two colons:
|
||||||
|
|
||||||
| Item | Value | Qty |
|
| Item | Value | Qty |
|
||||||
| :--- | ---: | :---: |
|
| :------- | ----: | :---: |
|
||||||
| Computer | $1600 | 5 |
|
| Computer | $1600 | 5 |
|
||||||
| Phone | $12 | 12 |
|
| Phone | $12 | 12 |
|
||||||
| Pipe | $1 | 234 |
|
| Pipe | $1 | 234 |
|
||||||
|
|
||||||
|
|
||||||
### Definition Lists
|
### 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:
|
SmartyPants converts ASCII punctuation characters into "smart" typographic punctuation HTML entities. For example:
|
||||||
|
|
||||||
| | ASCII | HTML |
|
| | ASCII | HTML |
|
||||||
---|---|---
|
----------------- | ---------------------------- | ------------------
|
||||||
| Single backticks | `'Isn't this fun?'` | 'Isn't this fun?' |
|
| Single backticks | `'Isn't this fun?'` | 'Isn't this fun?' |
|
||||||
| Quotes | `"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 |
|
| Dashes | `-- is en-dash, --- is em-dash` | -- is en-dash, --- is em-dash |
|
||||||
|
|
||||||
|
|
||||||
### Table of contents
|
### Table of contents
|
||||||
|
@ -30,7 +30,49 @@ Prism.languages.md = (function() {
|
|||||||
inside: {
|
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,
|
pattern: /^([*\-_] *){3,}$/gm,
|
||||||
};
|
};
|
||||||
md.li = {
|
md.li = {
|
||||||
@ -266,6 +308,8 @@ Prism.languages.md = (function() {
|
|||||||
}
|
}
|
||||||
md["h1 alt"].inside.rest = rest;
|
md["h1 alt"].inside.rest = rest;
|
||||||
md["h2 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.p.inside.rest = rest;
|
||||||
md.blockquote.inside.rest = rest;
|
md.blockquote.inside.rest = rest;
|
||||||
md.li.inside.rest = rest;
|
md.li.inside.rest = rest;
|
||||||
|
@ -1173,6 +1173,10 @@ a {
|
|||||||
color: @tertiary-color;
|
color: @tertiary-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
font: normal 0.9em @font-family-monospace;
|
||||||
|
}
|
||||||
|
|
||||||
.comment {
|
.comment {
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
color: @tertiary-color-light;
|
color: @tertiary-color-light;
|
||||||
|
Loading…
Reference in New Issue
Block a user