Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow external tools to insert references that are OK to skip #7

Merged
merged 1 commit into from
Apr 30, 2021
Merged

Conversation

oprypin
Copy link
Member

@oprypin oprypin commented Apr 25, 2021

E.g. mkdocstrings-crystal can proactively insert links (by writing out the exact HTML that's prescribed here) that in the end can turn out to not be present anywhere, and since those are auto-inserted, they are not actionable for the user, so there should be no warning for them. So mkdocstrings-crystal will switch to <span data-autorefs-optional="...">.

Also migrate the "required" case to new data- keys, because this is not specific to mkdocstrings now.

E.g. mkdocstrings-crystal can proactively insert links (by writing out the exact HTML that's prescribed here) that in the end can turn out to not be present anywhere, and since those are auto-inserted, they are not actionable for the user, so there should be no warning for them. So mkdocstrings-crystal will switch to `<span data-autorefs-optional="...">`.

Also migrate the "required" case to new data- keys, because this is not specific to mkdocstrings now.
Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree with this change 🙂
Good thing you renamed data attributes to autorefs instead of mkdocstrings.

@@ -10,7 +10,10 @@
from markdown.inlinepatterns import REFERENCE_RE, ReferenceInlineProcessor
from markdown.util import INLINE_PLACEHOLDER_RE

AUTO_REF_RE = re.compile(r'<span data-mkdocstrings-identifier=("?)(?P<identifier>[^"<>]*)\1>(?P<title>.*?)</span>')
AUTO_REF_RE = re.compile(
r"<span data-(?P<kind>autorefs-identifier|autorefs-optional|mkdocstrings-identifier)="
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess mkdocstrings-identifier is just for backward compatibility?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Just implicitly deprecated.

@pawamoy pawamoy merged commit 7619c28 into mkdocstrings:master Apr 30, 2021
oprypin added a commit to oprypin/mkdocstrings that referenced this pull request May 2, 2021
oprypin added a commit to oprypin/mkdocstrings that referenced this pull request May 2, 2021
pawamoy pushed a commit to mkdocstrings/mkdocstrings that referenced this pull request May 8, 2021
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.

2 participants