mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(tables): pipe character in code spans no longer breaks table
A code span with a pipe character no longer incorrectly breaks the cell table. Closes #465
This commit is contained in:
parent
f4f63c5c39
commit
0c933a01f9
BIN
dist/showdown.js
vendored
BIN
dist/showdown.js
vendored
Binary file not shown.
BIN
dist/showdown.js.map
vendored
BIN
dist/showdown.js.map
vendored
Binary file not shown.
BIN
dist/showdown.min.js
vendored
BIN
dist/showdown.min.js
vendored
Binary file not shown.
BIN
dist/showdown.min.js.map
vendored
BIN
dist/showdown.min.js.map
vendored
Binary file not shown.
|
@ -61,14 +61,16 @@ showdown.subParser('tables', function (text, options, globals) {
|
|||
function parseTable (rawTable) {
|
||||
var i, tableLines = rawTable.split('\n');
|
||||
|
||||
// strip wrong first and last column if wrapped tables are used
|
||||
for (i = 0; i < tableLines.length; ++i) {
|
||||
// strip wrong first and last column if wrapped tables are used
|
||||
if (/^ {0,3}\|/.test(tableLines[i])) {
|
||||
tableLines[i] = tableLines[i].replace(/^ {0,3}\|/, '');
|
||||
}
|
||||
if (/\|[ \t]*$/.test(tableLines[i])) {
|
||||
tableLines[i] = tableLines[i].replace(/\|[ \t]*$/, '');
|
||||
}
|
||||
// parse code spans first, but we only support one line code spans
|
||||
tableLines[i] = showdown.subParser('codeSpans')(tableLines[i], options, globals);
|
||||
}
|
||||
|
||||
var rawHeaders = tableLines[0].split('|').map(function (s) { return s.trim();}),
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>PowerShell command</th>
|
||||
<th>Example</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Get-Service</td>
|
||||
<td><code>Get-Service | Stop-Service -WhatIf</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,3 @@
|
|||
|PowerShell command|Example|
|
||||
|--|--|
|
||||
|Get-Service|`Get-Service | Stop-Service -WhatIf`|
|
Loading…
Reference in New Issue
Block a user