mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(makeMarkdown): handle <br> tags converting html to markdown
Convert <br> tags to 2 spaces + newline rather than leaving the tag in place when converting HTML to MD
This commit is contained in:
parent
82f90ebda2
commit
201969473a
5
src/subParsers/makemarkdown/break.js
Normal file
5
src/subParsers/makemarkdown/break.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
showdown.subParser('makeMarkdown.break', function () {
|
||||
'use strict';
|
||||
|
||||
return ' \n';
|
||||
});
|
|
@ -109,6 +109,10 @@ showdown.subParser('makeMarkdown.node', function (node, globals, spansOnly) {
|
|||
txt = showdown.subParser('makeMarkdown.image')(node, globals);
|
||||
break;
|
||||
|
||||
case 'br':
|
||||
txt = showdown.subParser('makeMarkdown.break')(node, globals);
|
||||
break;
|
||||
|
||||
default:
|
||||
txt = node.outerHTML + '\n\n';
|
||||
}
|
||||
|
|
1
test/functional/makemarkdown/cases/standard/breaks.html
Normal file
1
test/functional/makemarkdown/cases/standard/breaks.html
Normal file
|
@ -0,0 +1 @@
|
|||
first line<br />and the second
|
2
test/functional/makemarkdown/cases/standard/breaks.md
Normal file
2
test/functional/makemarkdown/cases/standard/breaks.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
first line
|
||||
and the second
|
Loading…
Reference in New Issue
Block a user