From 3dec847f0eac7b0bc6be6e5879ee24fe685e6b56 Mon Sep 17 00:00:00 2001 From: Nikolay Kost Date: Fri, 14 Mar 2025 21:46:20 +0200 Subject: [PATCH] feat(285): add width and height and alt for img tag (#286) feat: add width and height and alt for img tag --- packages/bbob-preset-html5/src/defaultTags.ts | 1 + packages/bbob-preset-html5/test/index.test.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/packages/bbob-preset-html5/src/defaultTags.ts b/packages/bbob-preset-html5/src/defaultTags.ts index 8ef7d02..51f6580 100644 --- a/packages/bbob-preset-html5/src/defaultTags.ts +++ b/packages/bbob-preset-html5/src/defaultTags.ts @@ -107,6 +107,7 @@ export const defaultTags = (function createTags() { toNode( "img", { + ...node.attrs, src: render(node.content), }, null diff --git a/packages/bbob-preset-html5/test/index.test.ts b/packages/bbob-preset-html5/test/index.test.ts index 9d82ce8..1cb8e00 100644 --- a/packages/bbob-preset-html5/test/index.test.ts +++ b/packages/bbob-preset-html5/test/index.test.ts @@ -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 = 'Lubeck city gate'; + + expect(parse(input)).toBe(result); + }); + test('[quote="author"]quoted text[/quote]', () => { const input = '[quote="author"]quoted text[/quote]'; const result = '

quoted text

';