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

feat(285): add width and height and alt for img tag (#286)

feat: add width and height and alt for img tag
This commit is contained in:
Nikolay Kost
2025-03-14 21:46:20 +02:00
committed by GitHub
parent 9fc8f216a3
commit 3dec847f0e
2 changed files with 8 additions and 0 deletions
@@ -107,6 +107,7 @@ export const defaultTags = (function createTags() {
toNode(
"img",
{
...node.attrs,
src: render(node.content),
},
null
@@ -62,6 +62,13 @@ describe('@bbob/preset-html5', () => {
expect(parse(input)).toBe(result);
});
test('[img width="100" height="50" alt="Lubeck city gate" title="This is one of the medieval city gates of Lubeck"]https://www.bbcode.org/images/lubeck_small.jpg[/img]', () => {
const input = '[img width="100" height="50" alt="Lubeck city gate" title="This is one of the medieval city gates of Lubeck"]https://www.bbcode.org/images/lubeck_small.jpg[/img]';
const result = '<img width="100" height="50" alt="Lubeck city gate" title="This is one of the medieval city gates of Lubeck" src="https://www.bbcode.org/images/lubeck_small.jpg"/>';
expect(parse(input)).toBe(result);
});
test('[quote="author"]quoted text[/quote]', () => {
const input = '[quote="author"]quoted text[/quote]';
const result = '<blockquote><p>quoted text</p></blockquote>';