feat(markdown): add to_markdown strip/convert filters#255
Draft
gaborbernat wants to merge 2 commits into
Draft
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the mutually exclusive
stripandconvertkeywords toNode.to_markdown, the tag filtersmarkdownifyexposes under the same names.stripnames tags whose markup is dropped while their text keeps flowing.convertnames 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
markdownifyignores 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