Skip to content

fix(callouts): preserve multi-class callouts and empty data-callout-fold - #538

Open
EnesKartal wants to merge 1 commit into
kepano:mainfrom
EnesKartal:fix/callout-multi-class
Open

EnesKartal wants to merge 1 commit into
kepano:mainfrom
EnesKartal:fix/callout-multi-class

Conversation

@EnesKartal

Copy link
Copy Markdown
Contributor

Fixes #534

Summary

  • Updated stripUnwantedAttributes in src/standardize.ts to preserve callout / callout-* class tokens even when an element has additional classes (such as Quartz's class="callout tip"), instead of requiring the entire class attribute value to match /^callout(?:-|$)/.
  • Updated standardizeCallouts in src/elements/callouts.ts to check !el.getAttribute('data-callout-fold') instead of !el.hasAttribute('data-callout-fold'), so collapsed Quartz callouts with an empty data-callout-fold attribute receive - (or + when expandable).
  • Added unit tests in tests/callouts.test.ts.

Verification

  • npx vitest run tests/callouts.test.ts tests/markdown.test.ts tests/markdown-xss.test.ts (3 test files, 139 tests passed)
  • npm run lint:unused (passed)

This branch has not been deployed

No deployments
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.

Bug: Callouts with more than one class, such as callout tip, convert to plain paragraphs

1 participant