Skip to content

Commit

Permalink
Fix < escaping in sig
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac-Flath committed Oct 19, 2024
1 parent e8ea247 commit a2f9c1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nbdev/showdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ def _repr_html_(self):
doc += f'<div style="float:right; font-size:smaller">{_html_link(src, "source")}</div>\n'
doc += f'<h{self.title_level}>{self.nm}</h{self.title_level}>\n'
sig = _fmt_sig(self.sig) if self.sig else ''
# Escape < and > characters in the signature
sig = sig.replace('<', '&lt;').replace('>', '&gt;')
doc += f'<blockquote><pre><code>{self.nm} {sig}</code></pre></blockquote>'
if self.docs:
doc += f"<p><i>{self.docs}</i></p>"
Expand Down
2 changes: 2 additions & 0 deletions nbs/api/08_showdoc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,8 @@
" doc += f'<div style=\"float:right; font-size:smaller\">{_html_link(src, \"source\")}</div>\\n'\n",
" doc += f'<h{self.title_level}>{self.nm}</h{self.title_level}>\\n'\n",
" sig = _fmt_sig(self.sig) if self.sig else ''\n",
" # Escape < and > characters in the signature\n",
" sig = sig.replace('<', '&lt;').replace('>', '&gt;')\n",
" doc += f'<blockquote><pre><code>{self.nm} {sig}</code></pre></blockquote>'\n",
" if self.docs:\n",
" doc += f\"<p><i>{self.docs}</i></p>\"\n",
Expand Down

0 comments on commit a2f9c1d

Please sign in to comment.