diff --git a/src/convert/divOrPTagsHandler.js b/src/convert/divOrPTagsHandler.js index e958abf..0627b88 100644 --- a/src/convert/divOrPTagsHandler.js +++ b/src/convert/divOrPTagsHandler.js @@ -1,15 +1,16 @@ module.exports = { name: 'dirOrPTagsHandler', - checkIsAllowed: (context, {tag}) => ['div', 'p'].includes(tag), + checkIsAllowed: (context, {tag}) => ['div', 'p', 'section'].includes(tag), after: (context) => { context.commands.push({name: 'newLine'}); return context; }, sanitizeHtml: { - allowedTags: [ 'div', 'p' ], + allowedTags: [ 'div', 'p', 'section' ], allowedAttributes: { p: [ 'style' ], div: [ 'style' ], + section: [ 'style' ], }, }, }; \ No newline at end of file diff --git a/test/convert.js b/test/convert.js index eaf3e41..755c11c 100644 --- a/test/convert.js +++ b/test/convert.js @@ -39,6 +39,27 @@ me

assert.deepStrictEqual(await convert(template), exptectedResult); }); + + it('section tag works like div tag', async () => { + const template = ` +
section content
+
div content
+
bold section
+`; + + const exptectedResult = [ + {name: 'print', data: 'section content'}, + {name: 'newLine'}, + {name: 'print', data: 'div content'}, + {name: 'newLine'}, + {name: 'bold', data: true}, + {name: 'print', data: 'bold section'}, + {name: 'bold', data: false}, + {name: 'newLine'}, + ]; + + assert.deepStrictEqual(await convert(template), exptectedResult); + }); it('has special treatment for simple table', async () => {