Merge pull request #1922 from umap-project/smaller-headings

chore: smaller headings in descriptions
This commit is contained in:
Yohan Boniface 2024-06-21 16:39:44 +02:00 committed by GitHub
commit 9fabfe08cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View file

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

View file

@ -11,14 +11,14 @@ global.JSDOM = JSDOM
describe('Utils', function () {
describe('#toHTML()', 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 () {
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 () {
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 () {
@ -43,7 +43,7 @@ describe('Utils', function () {
it('should handle simple link in title', function () {
assert.equal(
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 () {
assert.equal(
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>'
)
})
})