2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-05-15 11:59:37 +03:00

feat(preset-html5): list type attribute support (#18)

now you can use [list=1] or [list=A] to produce <ol type="A"></ol> lists
This commit is contained in:
Nikolay Kostyurin
2019-06-17 22:09:30 +02:00
committed by GitHub
parent c4f78c1230
commit 847c55e836
2 changed files with 18 additions and 2 deletions
@@ -125,8 +125,10 @@ export default {
content: node.content,
}),
list: node => ({
tag: 'ul',
attrs: {},
tag: getUniqAttr(node.attrs) ? 'ol' : 'ul',
attrs: getUniqAttr(node.attrs) ? {
type: getUniqAttr(node.attrs),
} : {},
content: asListItems(node.content),
}),
};
@@ -99,6 +99,20 @@ describe('@bbob/preset-html5', () => {
expect(parse(input)).toBe(result);
});
test('[list=1][/list]', () => {
const input = `[list=1][/list]`;
const result = `<ol type="1"></ol>`;
expect(parse(input)).toBe(result);
});
test('[list=A][/list]', () => {
const input = `[list=A][/list]`;
const result = `<ol type="A"></ol>`;
expect(parse(input)).toBe(result);
});
test(`[table][/table]`, () => {
const input = `[table][tr][td]table 1[/td][td]table 2[/td][/tr][tr][td]table 3[/td][td]table 4[/td][/tr][/table]`;
const result = `<table><tr><td>table 1</td><td>table 2</td></tr><tr><td>table 3</td><td>table 4</td></tr></table>`;