Skip to content

Commit 01bcb8f

Browse files
committed
add extlinks + external links open in new tab
1 parent 22c75f1 commit 01bcb8f

File tree

5 files changed

+72
-35
lines changed

5 files changed

+72
-35
lines changed

Diff for: docs/source/_exts/patched_html_translator.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from sphinx.util.docutils import is_html5_writer_available
2+
from sphinx.writers.html import HTMLTranslator
3+
from sphinx.writers.html5 import HTML5Translator
4+
5+
6+
class PatchedHTMLTranslator(
7+
HTML5Translator if is_html5_writer_available() else HTMLTranslator
8+
):
9+
def starttag(self, node, tagname, *args, **attrs):
10+
if (
11+
tagname == "a"
12+
and "target" not in attrs
13+
and (
14+
"external" in attrs.get("class", "")
15+
or "external" in attrs.get("classes", [])
16+
)
17+
):
18+
attrs["target"] = "_blank"
19+
attrs["ref"] = "noopener noreferrer"
20+
return super().starttag(node, tagname, *args, **attrs)
21+
22+
23+
def setup(app):
24+
app.set_translator("html", PatchedHTMLTranslator)

Diff for: docs/source/changelog.rst

+28-28
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,39 @@ with respect to its siblings in the layout. The
1717
:attr:`~idom.config.IDOM_FEATURE_INDEX_AS_DEFAULT_KEY` feature flag has been introduced
1818
to allow users to enable this behavior early.
1919

20-
- add feature flag for default key behavior - `42ee01c <https://github.com/idom-team/idom/commit/42ee01c>`__
21-
- use unique object instead of index as default key - `5727ab4 <https://github.com/idom-team/idom/commit/5727ab4>`__
22-
- make HookCatcher/StaticEventHandlers testing utils - `1abfd76 <https://github.com/idom-team/idom/commit/1abfd76>`__
23-
- add element and component identity - `5548f02 <https://github.com/idom-team/idom/commit/5548f02>`__
24-
- minor doc updates - `e5511d9 <https://github.com/idom-team/idom/commit/e5511d9>`__
25-
- add tests for callback identity preservation with keys - `72e03ec <https://github.com/idom-team/idom/commit/72e03ec>`__
26-
- add 'key' to VDOM spec - `c3236fe <https://github.com/idom-team/idom/commit/c3236fe>`__
27-
- Rename validate_serialized_vdom to validate_vdom - `d04faf9 <https://github.com/idom-team/idom/commit/d04faf9>`__
28-
- EventHandler should not serialize itself - `f7a59f2 <https://github.com/idom-team/idom/commit/f7a59f2>`__
29-
- fix docs typos - `42b2e20 <https://github.com/idom-team/idom/commit/42b2e20>`__
30-
- fixes: #331 - add roadmap to docs - `4226c12 <https://github.com/idom-team/idom/commit/4226c12>`__
20+
- add feature flag for default key behavior - :commit:`42ee01c`
21+
- use unique object instead of index as default key - :commit:`5727ab4`
22+
- make HookCatcher/StaticEventHandlers testing utils - :commit:`1abfd76`
23+
- add element and component identity - :commit:`5548f02`
24+
- minor doc updates - :commit:`e5511d9`
25+
- add tests for callback identity preservation with keys - :commit:`72e03ec`
26+
- add 'key' to VDOM spec - :commit:`c3236fe`
27+
- Rename validate_serialized_vdom to validate_vdom - :commit:`d04faf9`
28+
- EventHandler should not serialize itself - :commit:`f7a59f2`
29+
- fix docs typos - :commit:`42b2e20`
30+
- fixes: #331 - add roadmap to docs - :commit:`4226c12`
3131

3232
0.23.1
3333
------
3434

35-
- fix non-deterministic return order in install() - `494d5c2 <https://github.com/idom-team/idom/commit/494d5c2>`__
35+
- fix non-deterministic return order in install() - :commit:`494d5c2`
3636

3737
0.23.0
3838
------
3939

40-
- add changelog to docs - `9cbfe94 <https://github.com/idom-team/idom/commit/9cbfe94>`__
41-
- automatically reconnect to server - `3477e2b <https://github.com/idom-team/idom/commit/3477e2b>`__
42-
- allow no reconnect in client - `ef263c2 <https://github.com/idom-team/idom/commit/ef263c2>`__
43-
- cleaner way to specify import sources - `ea19a07 <https://github.com/idom-team/idom/commit/ea19a07>`__
44-
- add the idom-react-client back into the main repo - `5dcc3bb <https://github.com/idom-team/idom/commit/5dcc3bb>`__
45-
- implement fastapi render server - `94e0620 <https://github.com/idom-team/idom/commit/94e0620>`__
46-
- improve docstring for IDOM_CLIENT_BUILD_DIR - `962d885 <https://github.com/idom-team/idom/commit/962d885>`__
47-
- cli improvements - `788fd86 <https://github.com/idom-team/idom/commit/788fd86>`__
48-
- rename SERIALIZED_VDOM_JSON_SCHEMA to VDOM_JSON_SCHEMA - `74ad578 <https://github.com/idom-team/idom/commit/74ad578>`__
49-
- better logging for modules - `39565b9 <https://github.com/idom-team/idom/commit/39565b9>`__
50-
- move client utils into private module - `f825e96 <https://github.com/idom-team/idom/commit/f825e96>`__
51-
- redirect BUILD_DIR imports to IDOM_CLIENT_BUILD_DIR option - `53fb23b <https://github.com/idom-team/idom/commit/53fb23b>`__
52-
- upgrade snowpack - `5697a2d <https://github.com/idom-team/idom/commit/5697a2d>`__
53-
- better logs for idom.run + flask server - `2b34e3d <https://github.com/idom-team/idom/commit/2b34e3d>`__
54-
- move package to src dir - `066c9c5 <https://github.com/idom-team/idom/commit/066c9c5>`__
55-
- idom restore uses backup - `773f78e <https://github.com/idom-team/idom/commit/773f78e>`__
40+
- add changelog to docs - :commit:`9cbfe94`
41+
- automatically reconnect to server - :commit:`3477e2b`
42+
- allow no reconnect in client - :commit:`ef263c2`
43+
- cleaner way to specify import sources - :commit:`ea19a07`
44+
- add the idom-react-client back into the main repo - :commit:`5dcc3bb`
45+
- implement fastapi render server - :commit:`94e0620`
46+
- improve docstring for IDOM_CLIENT_BUILD_DIR - :commit:`962d885`
47+
- cli improvements - :commit:`788fd86`
48+
- rename SERIALIZED_VDOM_JSON_SCHEMA to VDOM_JSON_SCHEMA - :commit:`74ad578`
49+
- better logging for modules - :commit:`39565b9`
50+
- move client utils into private module - :commit:`f825e96`
51+
- redirect BUILD_DIR imports to IDOM_CLIENT_BUILD_DIR option - :commit:`53fb23b`
52+
- upgrade snowpack - :commit:`5697a2d`
53+
- better logs for idom.run + flask server - :commit:`2b34e3d`
54+
- move package to src dir - :commit:`066c9c5`
55+
- idom restore uses backup - :commit:`773f78e`

Diff for: docs/source/conf.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
copyright = "2020, Ryan Morshead"
2828
author = "Ryan Morshead"
2929

30+
# -- Common External Links ---------------------------------------------------
31+
32+
extlinks = {
33+
"issue": ("https://github.com/idom-team/idom/issues/%s", "#"),
34+
"pull": ("https://github.com/idom-team/idom/pulls/%s", "#"),
35+
"discussion": ("https://github.com/idom-team/idom/discussions/%s", "#"),
36+
"commit": ("https://github.com/idom-team/idom/commit/%s", ""),
37+
}
38+
3039
# -- General configuration ---------------------------------------------------
3140

3241
# If your documentatirston needs a minimal Sphinx version, state it here.
@@ -42,15 +51,17 @@
4251
"sphinx.ext.coverage",
4352
"sphinx.ext.viewcode",
4453
"sphinx.ext.napoleon",
54+
"sphinx.ext.extlinks",
4555
"sphinx.ext.autosectionlabel",
4656
"sphinx_autodoc_typehints",
4757
"sphinx_panels",
4858
"sphinx_copybutton",
4959
# custom extensions
50-
"interactive_widget",
51-
"widget_example",
5260
"async_doctest",
5361
"copy_vdom_json_schema",
62+
"interactive_widget",
63+
"patched_html_translator",
64+
"widget_example",
5465
]
5566

5667
# Add any paths that contain templates here, relative to this directory.

Diff for: docs/source/roadmap.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ Roadmap
2525
primarilly be a tool for optimization rather than a functional requirement.
2626

2727
Related issues:
28+
:issue:`330`, :issue:`19`
2829

29-
- https://github.com/idom-team/idom/issues/330
30-
- https://github.com/idom-team/idom/issues/19
30+
Related work:
31+
:pull:`345`
3132

3233
**Reconsider Custom Component Interface**:
3334
One problem that's come up several times while implementing alternate client
@@ -45,6 +46,7 @@ Roadmap
4546
effort.
4647

4748
Related issues:
49+
:issue:`13`, :issue:`6`
4850

49-
- https://github.com/idom-team/idom-jupyter/issues/13
50-
- https://github.com/idom-team/idom-dash/issues/6
51+
Related work:
52+
in progress...

Diff for: noxfile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def parse_commit_reference(commit_ref: str) -> Tuple[str, str, str]:
175175

176176
for sha, msg, _ in map(parse_commit_reference, commit_references):
177177
if rst_format:
178-
sha_repr = f"`{sha} <https://github.com/idom-team/idom/commit/{sha}>`__"
178+
sha_repr = f":commit:`{sha}`"
179179
else:
180180
sha_repr = sha
181181
print(f"- {msg} - {sha_repr}")

0 commit comments

Comments
 (0)