Skip to content

Commit

Permalink
fix: blocks with code blocks not parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
benjypng committed Jul 20, 2024
1 parent 7f63361 commit c8af400
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/features/parse/semi-auto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export const semiAutoParse = async (
const { dateChar, scheduledChar, deadlineChar } = logseq.settings!
if (!dateChar || !scheduledChar || !deadlineChar) throw new Error()

// handle special characters in code
const backticksRx = /`(.*?)`/g
if (backticksRx.exec(content)) return ''
if (content.startsWith('```') || content.endsWith('```')) return content

switch (true) {
case content.includes('@from'): {
Expand All @@ -31,6 +29,7 @@ export const semiAutoParse = async (
return content
}
case content.includes(dateChar): {
if (content.includes(`\`${dateChar}${parsedText}\``)) return content
const checkTime = parse.checkIfChronoObjHasTime(chronoBlock[0]!.start)
content = content.replace(
`${dateChar}${parsedText}`,
Expand All @@ -42,6 +41,11 @@ export const semiAutoParse = async (
return content
}
case content.includes(scheduledChar) || content.includes(deadlineChar): {
if (
content.includes(`\`${scheduledChar}${parsedText}\``) ||
content.includes(`\`${deadlineChar}${parsedText}\``)
)
return content
if (scheduledChar === 'NA' || deadlineChar === 'NA') {
return content
}
Expand Down

0 comments on commit c8af400

Please sign in to comment.