diff --git a/umap/static/umap/js/modules/utils.js b/umap/static/umap/js/modules/utils.js index ef27a685..0ebb885a 100644 --- a/umap/static/umap/js/modules/utils.js +++ b/umap/static/umap/js/modules/utils.js @@ -124,9 +124,9 @@ export function toHTML(r, options) { } // headings and hr - r = r.replace(/^### (.*)(\r\n|\r|\n)?/gm, '
$1
') - r = r.replace(/^## (.*)(\r\n|\r|\n)?/gm, '

$1

') - r = r.replace(/^# (.*)(\r\n|\r|\n)?/gm, '

$1

') + r = r.replace(/^### (.*)(\r\n|\r|\n)?/gm, '
$1
') + r = r.replace(/^## (.*)(\r\n|\r|\n)?/gm, '
$1
') + r = r.replace(/^# (.*)(\r\n|\r|\n)?/gm, '

$1

') r = r.replace(/^---/gm, '
') // bold, italics diff --git a/umap/static/umap/unittests/utils.js b/umap/static/umap/unittests/utils.js index 7502cb14..2e352dff 100644 --- a/umap/static/umap/unittests/utils.js +++ b/umap/static/umap/unittests/utils.js @@ -11,14 +11,14 @@ global.JSDOM = JSDOM describe('Utils', function () { describe('#toHTML()', function () { it('should handle title', function () { - assert.equal(Utils.toHTML('# A title'), '

A title

') + assert.equal(Utils.toHTML('# A title'), '

A title

') }) it('should handle title followed by text', function () { - assert.equal(Utils.toHTML('# A title\nSome text.'), '

A title

Some text.') + assert.equal(Utils.toHTML('# A title\nSome text.'), '

A title

Some text.') }) it('should handle title in the middle of the content', function () { - assert.equal(Utils.toHTML('A phrase\n## A title'), 'A phrase\n

A title

') + assert.equal(Utils.toHTML('A phrase\n## A title'), 'A phrase\n
A title
') }) it('should handle hr', function () { @@ -43,7 +43,7 @@ describe('Utils', function () { it('should handle simple link in title', function () { assert.equal( Utils.toHTML('# http://osm.org'), - '

http://osm.org

' + '

http://osm.org

' ) }) @@ -180,7 +180,7 @@ describe('Utils', function () { it('title followed by bullet points', function () { assert.equal( Utils.toHTML('## Some title\n* First *point*\n* Second **point**\n* Last [[https://here.org|point]]'), - '

Some title

' + '
Some title
' ) }) })