2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-23 20:40:34 +03:00

feat(preset-html5): color tag #189, case insensitive tags #190 (#191)

* fix(preset-html5): add color tag #189

* fix(parser): case insensitive tags bug #190
This commit is contained in:
Nikolay Kost
2023-09-28 04:02:52 +03:00
committed by GitHub
parent 3bccca086f
commit 0c78831372
5 changed files with 58 additions and 2 deletions
@@ -87,4 +87,5 @@ export default {
return toNode(type ? 'ol' : 'ul', type ? { type } : {}, asListItems(node.content));
},
color: (node) => toNode('span', toStyle(`color: ${getUniqAttr(node.attrs)};`), node.content),
};
@@ -77,6 +77,13 @@ describe('@bbob/preset-html5', () => {
expect(parse(input)).toBe(result);
});
test('[color="red"]Red Text[/color]', () => {
const input = '[color="red"]Red Text[/color]';
const result = '<span style="color: red;">Red Text</span>';
expect(parse(input)).toBe(result);
});
test(`[list][*]Entry 1[/list]`, () => {
const input = `[list][*]Entry 1[*]Entry 2[/list]`;
const result = '<ul><li>Entry 1</li><li>Entry 2</li></ul>';