feat: add pageTitleFormatter config#2695
feat: add pageTitleFormatter config#2695sy-records wants to merge 4 commits intodocsifyjs:developfrom
Conversation
|
@sy-records is attempting to deploy a commit to the Docsify Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds a new Docsify configuration option to customize how the configured site name contributes to the browser tab title (document.title) during render, allowing users to override the default “strip HTML tags from name” behavior.
Changes:
- Introduces
pageTitleFormatterconfig option (defaultnull). - Updates render event logic to use
pageTitleFormatter(name)when provided, otherwise keep existing HTML-stripping behavior. - Documents the new option in the configuration reference.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/core/event/index.js | Uses optional pageTitleFormatter when composing document.title during onRender(). |
| src/core/config.js | Adds pageTitleFormatter to default config with JSDoc typing. |
| docs/configuration.md | Documents pageTitleFormatter option and provides an example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Adds a new configuration option to customize how the Docsify site name contributes to the browser document title during render, while preserving the existing default behavior when the option is not set.
Changes:
- Introduces
pageTitleFormatterconfig option (defaultnull) to optionally format the sitenamefordocument.title. - Updates the render event handler to use
pageTitleFormatter(name)when provided; otherwise keeps HTML-tag stripping fallback. - Documents the new configuration option in
docs/configuration.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/core/event/index.js | Uses optional pageTitleFormatter to compute the site-name portion of the page title on render. |
| src/core/config.js | Adds pageTitleFormatter to the default config object (typed, default null). |
| docs/configuration.md | Documents pageTitleFormatter with usage example and default behavior notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Adds a new configuration hook to customize how the Docsify site name is incorporated into the browser document title, primarily to support HTML-containing names without automatic stripping.
Changes:
- Add
pageTitleFormatterto the default config schema. - Update title composition in
onRender()to optionally delegate site-name formatting topageTitleFormatter. - Document the new configuration option in
docs/configuration.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/core/event/index.js | Uses optional pageTitleFormatter when composing document.title from name and current section. |
| src/core/config.js | Adds pageTitleFormatter to the default config shape/type annotations. |
| docs/configuration.md | Documents pageTitleFormatter option and provides an example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Summary
If a pageTitleFormatter is provided, let the user format the name
(no automatic HTML stripping). Otherwise, default to stripping
HTML tags from the configured name.
Related issue, if any:
Close #2610
What kind of change does this PR introduce?
For any code change,
Does this PR introduce a breaking change?
Tested in the following browsers: