Skip to content

Conversation

@jacobsorme
Copy link
Contributor

Summary

New option :fragmentFullLine that when used will enable full-line ignore of file embed fragment lines.

Related issue, if any:

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed

Does this PR introduce a breaking change?

  • Yes
  • No

Tested in the following browsers:

  • Chrome
  • Firefox
  • Safari
  • Edge

@vercel
Copy link

vercel bot commented Nov 10, 2025

@jacobsorme is attempting to deploy a commit to the Docsify Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Nov 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docsify-preview Ready Ready Preview Comment Nov 11, 2025 2:38am

@sy-records sy-records changed the title Fragment identifier full line ignore feat: Fragment identifier full line ignore Nov 11, 2025
Copilot finished reviewing on behalf of sy-records November 11, 2025 02:39
Copy link

Copilot AI left a 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 fragmentFullLine parameter to extractFragmentContent function and updated regex logic to support full-line matching
  • Updated compiler to pass through fragmentFullLine configuration
  • 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.
Copy link

Copilot AI Nov 11, 2025

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).

Suggested change
* @param {boolean} fullLine - The fragment identifier to search for.
* @param {boolean} fullLine - Boolean flag to enable full-line matching of fragment identifiers.

Copilot uses AI. Check for mistakes.
* @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.
Copy link

Copilot AI Nov 11, 2025

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'.

Suggested change
* @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.

Copilot uses AI. Check for mistakes.
return text;
}

let fragmentRegex = `###|\\/\\/\\/\\s*\\[${fragment}\\]`;
Copy link

Copilot AI Nov 11, 2025

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].

Suggested change
let fragmentRegex = `###|\\/\\/\\/\\s*\\[${fragment}\\]`;
let fragmentRegex = `(?:###|\\/\\/\\/)\\s*\\[${fragment}\\]`;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant