Skip to content

refactor(Image,ImgSize): extend Image base extension instead of replacing it#1052

Open
d3m1d0v wants to merge 1 commit intomainfrom
refactor-img-size
Open

refactor(Image,ImgSize): extend Image base extension instead of replacing it#1052
d3m1d0v wants to merge 1 commit intomainfrom
refactor-img-size

Conversation

@d3m1d0v
Copy link
Copy Markdown
Member

@d3m1d0v d3m1d0v commented Apr 9, 2026

Summary

  • Replace builder.addNode(...) in ImgSizeSpecs with overrideNodeSpec / overrideMarkdownTokenParserSpec / overrideNodeSerializerSpec, eliminating duplication of the base image node spec (same pattern applied to YfmHeading previously)
  • Extract imageToMarkdown() serializer factory to ImageSpecs/utils.ts so ImgSizeSpecs can extend it via renderExtra callback instead of copy-pasting the serializer logic
  • Update yfm.ts and yfm-specs.ts presets so ImageSpecs is loaded through the base preset and ImgSize only overrides it; fix pre-existing bug isNumber(width) ? height : nullisNumber(width) ? width : null

@gravity-ui
Copy link
Copy Markdown

gravity-ui bot commented Apr 9, 2026

Storybook Deployed

@d3m1d0v d3m1d0v changed the title refactor(Image,ImgSize): extend Image base extension instead of replacing it entirely refactor(Image,ImgSize): extend Image base extension instead of replacing it Apr 9, 2026
@gravity-ui
Copy link
Copy Markdown

gravity-ui bot commented Apr 9, 2026

🎭 Playwright Report

@d3m1d0v d3m1d0v marked this pull request as ready for review April 9, 2026 15:46
@d3m1d0v d3m1d0v requested a review from makhnatkin as a code owner April 9, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant