-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
feat: Fragment identifier full line ignore #2626
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: develop
Are you sure you want to change the base?
Conversation
|
@jacobsorme 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.
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 a new :fragmentFullLine option that enables full-line exclusion of fragment identifier lines when embedding file fragments. When enabled, the entire line containing the fragment marker (e.g., /// [demo] comment text) is excluded from the embedded content, not just the marker itself.
Key Changes:
- Added
fragmentFullLineparameter toextractFragmentContentfunction and updated regex logic to support full-line matching - Updated compiler to pass through
fragmentFullLineconfiguration - Fixed grammar in media error messages ("Not Support" → "Not Supported")
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/integration/example.test.js | Added integration test verifying full-line fragment exclusion behavior |
| src/core/render/embed.js | Modified extractFragmentContent to accept and handle fullLine parameter with updated regex logic |
| src/core/render/compiler.js | Added fragmentFullLine property assignment to embed configuration |
| src/core/render/compiler/media.js | Fixed grammar in video and audio error messages |
| docs/embed-files.md | Documented the new :fragmentFullLine option |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * | ||
| * @param {string} text - The input text that may contain embedded fragments. | ||
| * @param {string} fragment - The fragment identifier to search for. | ||
| * @param {boolean} fullLine - The fragment identifier to search for. |
Copilot
AI
Nov 11, 2025
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 parameter description for fullLine is incorrect. It should describe that this is a boolean flag to enable full-line matching of fragment identifiers, not 'The fragment identifier to search for' (which is the description for the fragment parameter).
| * @param {boolean} fullLine - The fragment identifier to search for. | |
| * @param {boolean} fullLine - Boolean flag to enable full-line matching of fragment identifiers. |
| * @param {string} text - The input text that may contain embedded fragments. | ||
| * @param {string} fragment - The fragment identifier to search for. | ||
| * @param {boolean} fullLine - The fragment identifier to search for. | ||
| * @returns {string} - The extracted and demented content, or an empty string if not found. |
Copilot
AI
Nov 11, 2025
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.
Corrected spelling of 'demented' to 'dedented'.
| * @returns {string} - The extracted and demented content, or an empty string if not found. | |
| * @returns {string} - The extracted and dedented content, or an empty string if not found. |
| return text; | ||
| } | ||
|
|
||
| let fragmentRegex = `###|\\/\\/\\/\\s*\\[${fragment}\\]`; |
Copilot
AI
Nov 11, 2025
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 regex pattern is incorrect when fullLine is false. This pattern matches either ### alone OR /// followed by \\s*[fragment], but it doesn't match ### followed by \\s*[fragment]. The pattern should be wrapped in a non-capturing group: let fragmentRegex = (?:###|\/\/\/)\s*\[${fragment}\]; to match either ### or ///, then \\s*[fragment].
| let fragmentRegex = `###|\\/\\/\\/\\s*\\[${fragment}\\]`; | |
| let fragmentRegex = `(?:###|\\/\\/\\/)\\s*\\[${fragment}\\]`; |
Summary
New option
:fragmentFullLinethat when used will enable full-line ignore of file embed fragment lines.Related issue, if any:
What kind of change does this PR introduce?
For any code change,
Does this PR introduce a breaking change?
Tested in the following browsers: