Skip to content

links aren't rendered as code #795

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

Merged
merged 2 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nbdev/doclinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _link_sym(self:NbdevLookup, m):
s = self[l]
if s is None: return m.group(0)
l = l.replace('\\', r'\\')
return rf"[{l}]({s})"
return rf"[`{l}`]({s})"

_re_backticks = re.compile(r'`([^`\s]+)`')
@patch
Expand Down
4 changes: 2 additions & 2 deletions nbs/04b_doclinks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@
" s = self[l]\n",
" if s is None: return m.group(0)\n",
" l = l.replace('\\\\', r'\\\\')\n",
" return rf\"[{l}]({s})\"\n",
" return rf\"[`{l}`]({s})\"\n",
"\n",
"_re_backticks = re.compile(r'`([^`\\s]+)`')\n",
"@patch\n",
Expand Down Expand Up @@ -619,7 +619,7 @@
{
"data": {
"text/markdown": [
"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/read.html#get_config) but not a link to `foobar`.\n",
"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/read.html#get_config) but not a link to `foobar`.\n",
"And not a link to <code>dict2nb</code>.\n",
"\n",
" This is not a link to `get_config`\n",
Expand Down
6 changes: 3 additions & 3 deletions nbs/09_processors.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -750,9 +750,9 @@
"outputs": [],
"source": [
"res = _run_procs(add_links)\n",
"assert \"[numpy.array](https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array)\" in res\n",
"assert \"[ModuleMaker](https://nbdev.fast.ai/maker.html#modulemaker) but not a link to `foobar`.\" in res\n",
"assert \"A link in a docstring: [ModuleMaker](https://nbdev.fast.ai/maker.html#modulemaker).\" in res\n",
"assert \"[`numpy.array`](https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array)\" in res\n",
"assert \"[`ModuleMaker`](https://nbdev.fast.ai/maker.html#modulemaker) but not a link to `foobar`.\" in res\n",
"assert \"A link in a docstring: [`ModuleMaker`](https://nbdev.fast.ai/maker.html#modulemaker).\" in res\n",
"assert \"And not a link to <code>dict2nb</code>.\" in res"
]
},
Expand Down