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

Improve backtick regex matching for function names #1469

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

ncoop57
Copy link

@ncoop57 ncoop57 commented Nov 19, 2024

This PR improves the regex detection for doclinks in nbdev. Specifically it now handles parenthesis being included in backticks:

md = """This is a link to `numpy.array` and to `get_config()` but not a link to `foobar`.
And not a link to <code>dict2nb</code>.

    This is not a link to `get_config`
"""
print(NbdevLookup('nbdev').linkify(md))
This is a link to [`numpy.array`](https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array) and to [`get_config()`](https://nbdev.fast.ai/api/config.html#get_config) but not a link to `foobar`.
And not a link to <code>dict2nb</code>.

    This is not a link to `get_config`

Additional tests were also added to check against edge cases.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@ncoop57
Copy link
Author

ncoop57 commented Nov 19, 2024

@jph00

@jph00
Copy link
Contributor

jph00 commented Nov 19, 2024

Great stuff @ncoop57 :D

@jph00 jph00 merged commit ccdc0b6 into AnswerDotAI:main Nov 19, 2024
10 checks passed
@ncoop57 ncoop57 deleted the regex branch November 20, 2024 00:04
@jph00 jph00 added the enhancement New feature or request label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants