-
Notifications
You must be signed in to change notification settings - Fork 322
feat(sync): extract style attributes from HTML comments #6694
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
Conversation
Add extractStyleAttributes() function to convert headings like:
`#### Heading <!-- {.class} -->`
to:
`#### Heading {.class}`
This allows source READMEs to render cleanly on GitHub while still
supporting Hugo style classes in docs-v2.
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 functionality to extract Hugo style attributes from HTML comments in plugin READMEs during the sync process, allowing source files to render cleanly on GitHub while supporting Hugo styling in the documentation site.
Key changes:
- Adds
extractStyleAttributes()function that converts#### Heading <!-- {.class} -->to#### Heading {.class} - Integrates the transformation into the content processing pipeline between paragraph enhancement and code block formatting
|
To clarify, these aren't just style attributes, these are custom html attributes as well (Goldmark Readme). For example: ## Heading 2 {.css-class #element-id attr="some value"}I think it even now supports custom attributes on any block element, including paragraphs: This is a markdown paragraph with custom attributes.
{#paragraph-id .custom-class attr="some value"}But I may be wrong about block element support. I vaguely remember testing. Does the regex account for this? Is the intent here to replace all of these attributes in the docs with HTML comments or just those in Telegraf READMEs? |
This script is currently only for the InfluxDB3 plugin READMEs, though I hope to extend it for client libs and other upstream docs soon. It won't be used for Telegraf--they have a separate workflow that they own. |
Summary
Add support for extracting Hugo style attributes from HTML comments in plugin READMEs during the sync process.
Problem
Hugo style attributes like
{.green}and{.orange}render as literal text on GitHub, making source READMEs look messy.Solution
Use HTML comments to hide style attributes in source:
The sync script extracts these and applies them:
Supported Classes
{.green},{.orange}- Color styling{.recommended},{.not-recommended}- Semantic styling{.classname}formatTest Plan