Skip to content

[FR] Fix literal <i> and <code> tags showing up in French headings - #1294

Open
IROFI wants to merge 11 commits into
huggingface:mainfrom
IROFI:fix-fr-literal-italic-tags-in-headings
Open

[FR] Fix literal <i> and <code> tags showing up in French headings#1294
IROFI wants to merge 11 commits into
huggingface:mainfrom
IROFI:fix-fr-literal-italic-tags-in-headings

Conversation

@IROFI

@IROFI IROFI commented Aug 21, 2026

Copy link
Copy Markdown

Problem

On the French pages, inline HTML shows up verbatim in headings. For example, chapter 6's end-of-chapter quiz displays

1. Quand devez-vous entraîner un nouveau <i> tokenizer </i> ?

7 of that quiz's 10 question titles were affected. The tags also leak into the generated anchors: #4-comment-le-pipeline-token-classification-gère-t-il-les-entités-qui-sétendent-sur-plusieurs-i-tokens-i-.

Cause

doc-builder flattens heading text to plain text (it needs it for the sidebar, the table of contents and the anchors). Inline HTML is escaped there, so <i> and <code> are rendered as literal text.

Italics are simply not available in headings: markdown emphasis is dropped too, and it leaves a stray space next to punctuation — still visible today on headings this PR does not touch, e.g. instruction ( prompt ) ? in fr/chapter1/10.

Fix

  • <i>x</i>x in headings: the words are kept and the tags dropped, since no emphasis can render there anyway.
  • <code>x</code>`x` in headings: the English source uses backticks in these exact 4 headings, and 34 other French headings already do.
  • <i> in body text, tip boxes and quiz answers renders correctly and is left untouched (251 occurrences).

114 headings across 50 files. No wording changed, no line added or removed.

Verification

Built chapters/fr locally with doc-builder build --html and compared against main:

before after
escaped (visible) inline tags in the built HTML 520 0
real <i> italics in the built HTML 135 135

make quality reports the same result as main (pre-existing failures, from a newer black than the one pinned in CI).

IROFI added 11 commits August 21, 2026 09:54
doc-builder flattens heading text to plain text: inline HTML is escaped, so
`<i>transformers</i>` was displayed verbatim on the website and leaked "i"
into the generated heading anchors.

Italics are not available in headings at all (markdown emphasis is dropped
there as well, and it even leaves a stray space around the emphasised words),
so the tags are removed and only the words are kept. `<i>` in body text,
blockquotes and quiz answers renders correctly and is left untouched.
Same as the previous commit: heading text is rendered as plain text, so the
`<i>` tags were shown verbatim.
Same as the previous commits: heading text is rendered as plain text, so the
`<i>` tags were shown verbatim.
Same as the previous commits: heading text is rendered as plain text, so the
`<i>` tags were shown verbatim.
Same as the previous commits: heading text is rendered as plain text, so the
`<i>` tags were shown verbatim.
Same as the previous commits: heading text is rendered as plain text, so the
`<i>` tags were shown verbatim. This is the most affected chapter: 7 of the 10
questions of the end-of-chapter quiz displayed the raw tags in their title.
Same as the previous commits: heading text is rendered as plain text, so the
`<i>` tags were shown verbatim.
Same as the previous commits: heading text is rendered as plain text, so the
`<i>` tags were shown verbatim.
Same as the previous commits: heading text is rendered as plain text, so the
`<i>` tags were shown verbatim.
Last occurrence: same rendering issue on the "Live sessions and workshops"
page.
Same root cause as the <i> tags: doc-builder flattens heading text to plain
text, so `<code>train_new_from_iterator()</code>` was displayed verbatim in
the quiz question titles.

The English source uses backticks in these exact four headings, and 34 other
French headings already do, so this restores both parity and consistency.
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@IROFI

IROFI commented Aug 21, 2026

Copy link
Copy Markdown
Author

@lewtun @stevhliu for review, and @lbourdois as the maintainer of the French translation — a native-speaker check on the affected headings would be welcome.

Only headings are touched (114 of them): <i> and <code> were showing up as literal text there because doc-builder flattens heading text to plain text. <i> in body text, tip boxes and quiz answers renders correctly and is left untouched.

Note: the preview link above currently returns a 404 for me, so the rendering evidence in the description comes from a local doc-builder build --html of chapters/fr compared against main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants