Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/utils/documents.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function replaceContent(
* Perform tokenized sections replace in text.
* - Discover sections based on token marker via RegExp in origin file.
* - Discover sections based on token marker via RegExp in target file.
* - replace sections in target file staring from the end, with sections defined in origin file
* - replace sections in target file starting from the end, with sections defined in origin file
* @param text File content
* @param frontmatter Referencing file front-matter
* @returns File content with replaced sections
Expand All @@ -187,7 +187,7 @@ function replaceSections(
frontmatter: graymatter.GrayMatterFile<string>,
) {
let result = text
// RegExp defining token pair to dicover sections in the document
// RegExp defining token pair to discover sections in the document
// [//]: # (<Section Token>)
const sectionMarkerRegex = /\[\/\/\]: # '([a-zA-Z\d]*)'/g
const sectionRegex =
Expand All @@ -198,7 +198,7 @@ function replaceSections(
for (const match of frontmatter.content.matchAll(sectionRegex)) {
if (match[1] !== match[2]) {
console.error(
`Origin section '${match[1]}' does not have matching closing token (found '${match[2]}'). Please make sure that each section has corresponsing closing token and that sections are not nested.`,
`Origin section '${match[1]}' does not have matching closing token (found '${match[2]}'). Please make sure that each section has corresponding closing token and that sections are not nested.`,
)
}

Expand All @@ -210,7 +210,7 @@ function replaceSections(
for (const match of result.matchAll(sectionRegex)) {
if (match[1] !== match[2]) {
console.error(
`Target section '${match[1]}' does not have matching closing token (found '${match[2]}'). Please make sure that each section has corresponsing closing token and that sections are not nested.`,
`Target section '${match[1]}' does not have matching closing token (found '${match[2]}'). Please make sure that each section has corresponding closing token and that sections are not nested.`,
)
}

Expand Down