Skip to content

fix(render-biblio): sanitize spaces in reference IDs#5177

Open
marcoscaceres wants to merge 3 commits intomainfrom
fix/biblio-id-spaces
Open

fix(render-biblio): sanitize spaces in reference IDs#5177
marcoscaceres wants to merge 3 commits intomainfrom
fix/biblio-id-spaces

Conversation

@marcoscaceres
Copy link
Copy Markdown
Contributor

Reference names with spaces (e.g. 'Ruby TTS Req') produced invalid HTML IDs containing spaces. Consolidates all bib- ID generation through a bibRefId() helper that replaces whitespace with hyphens.

Closes #5102

Reference names with spaces (e.g. 'Ruby TTS Req') produced invalid HTML
IDs containing spaces. Consolidates all bib- ID generation through a
bibRefId() helper that replaces whitespace with hyphens.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes invalid HTML id generation for bibliography entries when reference keys contain whitespace by centralizing bib fragment/id creation in a helper that replaces whitespace with hyphens.

Changes:

  • Add bibRefId(ref) helper to generate bib-... IDs with whitespace normalized to -.
  • Update inline citation rendering to link to #${bibRefId(key)}.
  • Update reference list rendering and alias/warn selectors to use the same normalized bib IDs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marcoscaceres
Copy link
Copy Markdown
Contributor Author

marcoscaceres commented Apr 13, 2026

Hmmm... definitely need a test for this one.

The examples are wild:

	  'Tokyo Ghoul: re': {
              title: "Tokyo Ghoul: re, Vol. 8, Chapter 76 “Daso (惰疎)",
              authors: ["Sui Ishida"], 
              id: "Tokyo Groul: re 8-76",
              date: "2016",
              publisher: "Shueisha",
          },
          'Transliteration Training Course': {
              title: "Textbook for the Volunteer Transliteration Training Course: Basics (In Japanese, 音訳ボランティア養成講習会テキスト 基礎課程編)",
	      href: "https://naiiv-books.net/shopdetail/000000000023/",
            date: "March 2010",
            publisher: "National Council of Japan for the Visually Impaired (In Japanese, 全国視覚障害者情報提供施設協会)",
          },

As I never expected ids from bib-ref to be used this way (they follow the short name rules from w3c)... but sure, why not!

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.

The names of the reference contain spaces

2 participants