chore: smaller headings in descriptions

We already have a h3 as title, both in the popup or in the panel
This commit is contained in:
Yohan Boniface 2024-06-21 14:05:47 +02:00
parent a1916ea15b
commit 3ed548b097
2 changed files with 8 additions and 8 deletions

View file

@ -124,9 +124,9 @@ export function toHTML(r, options) {
} }
// headings and hr // headings and hr
r = r.replace(/^### (.*)(\r\n|\r|\n)?/gm, '<h5>$1</h5>') r = r.replace(/^### (.*)(\r\n|\r|\n)?/gm, '<h6>$1</h6>')
r = r.replace(/^## (.*)(\r\n|\r|\n)?/gm, '<h4>$1</h4>') r = r.replace(/^## (.*)(\r\n|\r|\n)?/gm, '<h5>$1</h5>')
r = r.replace(/^# (.*)(\r\n|\r|\n)?/gm, '<h3>$1</h3>') r = r.replace(/^# (.*)(\r\n|\r|\n)?/gm, '<h4>$1</h4>')
r = r.replace(/^---/gm, '<hr>') r = r.replace(/^---/gm, '<hr>')
// bold, italics // bold, italics

View file

@ -11,14 +11,14 @@ global.JSDOM = JSDOM
describe('Utils', function () { describe('Utils', function () {
describe('#toHTML()', function () { describe('#toHTML()', function () {
it('should handle title', function () { it('should handle title', function () {
assert.equal(Utils.toHTML('# A title'), '<h3>A title</h3>') assert.equal(Utils.toHTML('# A title'), '<h4>A title</h4>')
}) })
it('should handle title followed by text', function () { it('should handle title followed by text', function () {
assert.equal(Utils.toHTML('# A title\nSome text.'), '<h3>A title</h3>Some text.') assert.equal(Utils.toHTML('# A title\nSome text.'), '<h4>A title</h4>Some text.')
}) })
it('should handle title in the middle of the content', function () { it('should handle title in the middle of the content', function () {
assert.equal(Utils.toHTML('A phrase\n## A title'), 'A phrase\n<h4>A title</h4>') assert.equal(Utils.toHTML('A phrase\n## A title'), 'A phrase\n<h5>A title</h5>')
}) })
it('should handle hr', function () { it('should handle hr', function () {
@ -43,7 +43,7 @@ describe('Utils', function () {
it('should handle simple link in title', function () { it('should handle simple link in title', function () {
assert.equal( assert.equal(
Utils.toHTML('# http://osm.org'), Utils.toHTML('# http://osm.org'),
'<h3><a href="http://osm.org" target="_blank">http://osm.org</a></h3>' '<h4><a href="http://osm.org" target="_blank">http://osm.org</a></h4>'
) )
}) })
@ -180,7 +180,7 @@ describe('Utils', function () {
it('title followed by bullet points', function () { it('title followed by bullet points', function () {
assert.equal( assert.equal(
Utils.toHTML('## Some title\n* First *point*\n* Second **point**\n* Last [[https://here.org|point]]'), Utils.toHTML('## Some title\n* First *point*\n* Second **point**\n* Last [[https://here.org|point]]'),
'<h4>Some title</h4><ul><li>First <em>point</em></li><li>Second <strong>point</strong></li><li>Last <a href="https://here.org" target="_blank">point</a></li></ul>' '<h5>Some title</h5><ul><li>First <em>point</em></li><li>Second <strong>point</strong></li><li>Last <a href="https://here.org" target="_blank">point</a></li></ul>'
) )
}) })
}) })