Skip to content

feat(markdown): add to_markdown strip/convert filters#255

Draft
gaborbernat wants to merge 2 commits into
tox-dev:mainfrom
gaborbernat:feat/markdown-base-url
Draft

feat(markdown): add to_markdown strip/convert filters#255
gaborbernat wants to merge 2 commits into
tox-dev:mainfrom
gaborbernat:feat/markdown-base-url

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

Add the mutually exclusive strip and convert keywords to Node.to_markdown, the tag filters markdownify exposes under the same names.

  • strip names tags whose markup is dropped while their text keeps flowing.
  • convert names the only tags to keep markup for, so every other tag is unwrapped.

Both compile to one 256-bit set indexed by the interned tag atom, so the per-element test is a constant-time bit lookup with no bound check. A name the tag table does not know folds to no entry (mirroring how markdownify ignores an unknown tag), and <script>/<style>/<head> still vanish whole.

Docs (how-to, explanation, migration markdownify row) and a changelog fragment are included. Coverage is 100% line+branch on the changed files under both llvm-cov and gcc-16.

closes #248

Add the mutually exclusive strip/convert keywords to
Node.to_markdown, mirroring markdownify's same-named tag filters:
strip drops the named tags' markup while keeping their text, and
convert keeps markup only for the named tags. Names compile to a
256-bit set indexed by the interned tag atom, so the per-element
test is a constant-time bit lookup; an unknown name folds to no
entry and script/style/head still vanish whole.

closes tox-dev#248
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.

to_markdown: strip/convert tag filters (markdownify parity)

1 participant