-
Notifications
You must be signed in to change notification settings - Fork 192
Add WARNING section when documentation is marked as deprecated #1479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add WARNING section when documentation is marked as deprecated #1479
Conversation
There was a problem hiding this comment.
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 adds automatic rendering of a deprecation warning at the top of documentation pages when the :deprecated: attribute is set in the page metadata.
Changes:
- Modified the Handlebars template to conditionally display a WARNING admonition block when
page.attributes.deprecatedis defined - The warning displays the component's shortname (or page title as fallback) with a deprecation message
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <tbody> | ||
| <tr> | ||
| <td class="icon"> | ||
| <div class="title">Warning</div> |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The icon structure doesn't match the expected AsciiDoc admonition format. According to the CSS in src/css/doc.css (lines 359-369), the icon should contain an <i> element with a title attribute. The CSS rule .doc .admonitionblock .icon i::after uses content: attr(title) to display the icon label. Replace <div class=\"title\">Warning</div> with <i title=\"Warning\"></i> to match the standard AsciiDoc admonition structure.
| <div class="title">Warning</div> | |
| <i title="Warning"></i> |
| <div class="title">Warning</div> | ||
| </td> | ||
| <td class="content"> | ||
| This {{or page.attributes.shortname page.title}} is deprecated |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message uses raw page.title as fallback, which will include HTML markup since page.title can contain formatted text. This could result in HTML tags being displayed in the deprecation message. Consider using a plain text attribute or sanitizing the output to avoid displaying HTML markup in the warning message.
| This {{or page.attributes.shortname page.title}} is deprecated | |
| This {{or page.attributes.shortname 'page'}} is deprecated |
| {{#with page.title}} | ||
| <h1 class="page">{{{this}}}</h1> | ||
| {{/with}} | ||
| {{#unless (eq page.attributes.deprecated undefined)}} |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition checks if deprecated is NOT undefined, which means the warning will appear for any truthy value or even empty string. According to the issue #1477, the attribute should be explicitly checked for a truthy value. Consider using {{#if page.attributes.deprecated}} instead, which provides clearer intent and properly handles falsy values.
4793c53 to
5965e58
Compare
|
🚀 Preview is available at https://pr-1479--camel.netlify.app |
|
hey @davsclaus exicted to see it merged... |
|
I do not see that deprecated warning such as |
|
this is wrong as it edits an article.hbs file which is not related to camel components. I think this should be done in camel-core/docs folder, where the components / languages et all are |
davsclaus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is wrong as it edits an article.hbs file which is not related to camel components. I think this should be done in camel-core/docs folder, where the components / languages et all are
|
Hi @davsclaus, Thanks for the review feedback! I've updated the implementation. The issue was: The article.hbs template was checking for page.attributes.deprecated, but Antora only exposes document attributes with the page- prefix to templates. The component docs in camel-core use :deprecated: (without the prefix), so the attribute wasn't accessible. The fix: I created an Antora extension (promote-deprecated-attribute.js) that promotes the document attributes to page attributes: :deprecated: → page-deprecated |
5965e58 to
429ddf6
Compare
- Create Antora extension to promote 'deprecated', 'supportlevel', and 'shortname'
document attributes to page attributes (page-deprecated, page-supportlevel,
page-shortname) so they are accessible in Handlebars templates
- Update article.hbs template to display warning banner when page.attributes.deprecated
is set, showing 'This {shortname} is deprecated' message
- Register the extension in antora-playbook.yml
429ddf6 to
5aa8475
Compare
This PR implements automatic rendering of a WARNING section on documentation pages when the page metadata marks the component (or language, data format, misc) as deprecated.
When a documentation page includes the
:deprecated:attribute in its AsciiDoc header, a prominent warning block will automatically appear at the top of the page (below the title), alerting users that the documented component/feature is deprecated.Changes
Modified
antora-ui-camel/src/partials/article.hbsto conditionally render a deprecation warning block:deprecatedattribute set:shortname:if available, otherwise falls back to the page titleImplementation Details
The solution:
{{#unless}}block to check if the deprecated attribute is undefined.admonitionblock.warning){{or}}helper to display shortname or fallback to page titleExample
For a page with:
The rendered page will display:
Testing
Locally tested:
:deprecated: trueshow the warningReferences
Closes #1477