From 851a18c3d6dbceb0c58291f4db543b51b627a663 Mon Sep 17 00:00:00 2001 From: krassowski <5832902+krassowski@users.noreply.github.com> Date: Mon, 31 Oct 2022 03:56:13 +0000 Subject: [PATCH] Add cell-id anchor for cell identification --- share/templates/base/cell_id_anchor.j2 | 5 +++++ share/templates/classic/base.html.j2 | 5 +++-- share/templates/lab/base.html.j2 | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 share/templates/base/cell_id_anchor.j2 diff --git a/share/templates/base/cell_id_anchor.j2 b/share/templates/base/cell_id_anchor.j2 new file mode 100644 index 000000000..b090895b1 --- /dev/null +++ b/share/templates/base/cell_id_anchor.j2 @@ -0,0 +1,5 @@ +{%- macro cell_id_anchor(cell) -%} + {% if cell.id | length > 0 -%} + id="{{ ('cell-id=' ~ cell.id) | escape_html -}}" + {%- endif %} +{%- endmacro %} diff --git a/share/templates/classic/base.html.j2 b/share/templates/classic/base.html.j2 index f5fe280c3..640067bf8 100644 --- a/share/templates/classic/base.html.j2 +++ b/share/templates/classic/base.html.j2 @@ -1,8 +1,9 @@ {%- extends 'display_priority.j2' -%} {% from 'celltags.j2' import celltags %} +{% from 'cell_id_anchor.j2' import cell_id_anchor %} {% block codecell %} -
+
{{ super() }}
{%- endblock codecell %} @@ -75,7 +76,7 @@ {% endblock output %} {% block markdowncell scoped %} -
+
{%- if resources.global_content_filter.include_input_prompt-%} {{ self.empty_in_prompt() }} {%- endif -%} diff --git a/share/templates/lab/base.html.j2 b/share/templates/lab/base.html.j2 index 248b1edf9..bde59787f 100644 --- a/share/templates/lab/base.html.j2 +++ b/share/templates/lab/base.html.j2 @@ -1,5 +1,6 @@ {%- extends 'display_priority.j2' -%} {% from 'celltags.j2' import celltags %} +{% from 'cell_id_anchor.j2' import cell_id_anchor %} {% block codecell %} {%- if not cell.outputs -%} @@ -8,7 +9,7 @@ {%- if not resources.global_content_filter.include_input -%} {%- set no_input_class="jp-mod-noInput" -%} {%- endif -%} -