Skip to content

Commit

Permalink
Fix title (#1833)
Browse files Browse the repository at this point in the history
clean_html returns valid HTML (wrapping the input around <p></p>) so we
should not use it for the title. Instead we can safely escape the HTML
while keeping quotes.
  • Loading branch information
martinRenou committed Aug 11, 2022
1 parent 8cbadbf commit 1652aa7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion share/jupyter/nbconvert/templates/classic/index.html.j2
Expand Up @@ -9,7 +9,7 @@
{%- block html_head -%}
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% set nb_title = nb.metadata.get('title', resources['metadata']['name']) | clean_html %}
{% set nb_title = nb.metadata.get('title', resources['metadata']['name']) | escape_html_keep_quotes %}
<title>{{nb_title}}</title>

{%- block html_head_js -%}
Expand Down
2 changes: 1 addition & 1 deletion share/jupyter/nbconvert/templates/lab/index.html.j2
Expand Up @@ -9,7 +9,7 @@
{%- block html_head -%}
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% set nb_title = nb.metadata.get('title', resources['metadata']['name']) | clean_html %}
{% set nb_title = nb.metadata.get('title', resources['metadata']['name']) | escape_html_keep_quotes %}
<title>{{nb_title}}</title>

{%- block html_head_js -%}
Expand Down
2 changes: 1 addition & 1 deletion share/jupyter/nbconvert/templates/reveal/index.html.j2
Expand Up @@ -20,7 +20,7 @@
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

{% set nb_title = nb.metadata.get('title', resources['metadata']['name']) | clean_html %}
{% set nb_title = nb.metadata.get('title', resources['metadata']['name']) | escape_html_keep_quotes %}
<title>{{nb_title}} slides</title>

{%- block html_head_js -%}
Expand Down

0 comments on commit 1652aa7

Please sign in to comment.