Skip to content

feat(core/best-practices): custom labels via data-label - #5253

Draft
marcoscaceres wants to merge 3 commits into
mainfrom
feat/3900-bp-labels
Draft

feat(core/best-practices): custom labels via data-label#5253
marcoscaceres wants to merge 3 commits into
mainfrom
feat/3900-bp-labels

Conversation

@marcoscaceres

@marcoscaceres marcoscaceres commented May 4, 2026

Copy link
Copy Markdown
Contributor

Refs #3900

A data-label attribute on a practice, and on the #bp-summary section, sets the label used in the marker and the summary heading, so a document using the practice system for principles can call them "Principle" instead of "Best Practice".

This does not close #3900, whose second half asks for multiple kinds of list in one document. There is a single counter across all practices, so mixed labels would interleave their numbering.

Written with AI: this change was generated by Claude. Per AI_POLICY.md.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends core/best-practices so authors can override the default “Best Practice” marker and summary heading via data-label, with accompanying spec coverage. It fits into ReSpec’s document-generation pipeline by customizing how practice markers and the generated best-practices summary are rendered.

Changes:

  • Add data-label support for individual .practicelab markers.
  • Add data-label support for the #bp-summary heading text.
  • Add a spec covering custom labels in generated summary entries.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/core/best-practices.js Adds custom-label handling for practice markers and summary headings, plus a French marker string.
tests/spec/core/best-practices-spec.js Adds a spec asserting custom labels appear in summary items and heading text.

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

Comment thread src/core/best-practices.js
Comment thread src/core/best-practices.js Outdated
Comment thread src/core/best-practices.js Outdated
@marcoscaceres
marcoscaceres force-pushed the feat/3900-bp-labels branch from 9f778e1 to 99a17f4 Compare May 4, 2026 07:16
@marcoscaceres

Copy link
Copy Markdown
Contributor Author

@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed?

…; add boxed practice test coverage

Agent-Logs-Url: https://github.com/speced/respec/sessions/7c04e153-af93-4a0e-bfe4-3dc140064f8b

Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Only set lang attribute on the bdi element when using the built-in
l10n label. Custom data-label text inherits lang from its DOM context
naturally, so forcing it can produce incorrect language metadata for
assistive technology.

Also adds test for boxed practice container with custom label.
@marcoscaceres
marcoscaceres marked this pull request as ready for review May 9, 2026 02:40
@marcoscaceres
marcoscaceres requested review from sidvishnoi and removed request for sidvishnoi May 9, 2026 02:40
@marcoscaceres
marcoscaceres marked this pull request as draft May 10, 2026 16:43
@marcoscaceres marcoscaceres added the AI Contains AI-generated logic; see AI_POLICY.md label Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Contains AI-generated logic; see AI_POLICY.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow relabeling and multiple kinds of "best practice"

3 participants