Skip to content

Commit

Permalink
Merge 8c4ef21 into 0e8c05c
Browse files Browse the repository at this point in the history
  • Loading branch information
SebinSong authored Dec 23, 2024
2 parents 0e8c05c + 8c4ef21 commit 4264c08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/views/utils/markdown-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export function splitStringByMarkdownCode (
// This function takes a markdown string and split it by texts written as either inline/block code.
// (e.g. `asdf`, ```const var = 123```)

const regExCodeMultiple = /(^[\s]*```\n[\s\S]*?```$)/gm // Detecting multi-line code-block by reg-exp - reference: https://regexr.com/4h9sh
const regExCodeMultiple = /(```\n[\s\S]*?```$)/gm // Detecting multi-line code-block by reg-exp - reference: https://regexr.com/4h9sh
const regExCodeInline = /(`.+`)/g
const splitByMulitpleCode = str.split(regExCodeMultiple)
const finalArr = []
Expand All @@ -168,7 +168,7 @@ export function splitStringByMarkdownCode (
if (regExCodeMultiple.test(segment)) {
finalArr.push({ type: 'code', text: segment })
} else {
const splitByInlineCode = segment.split(regExCodeInline)
const splitByInlineCode = segment.split(regExCodeInline) // Check for inline codes and mark them as type: 'code'
.map(piece => {
return regExCodeInline.test(piece)
? { type: 'code', text: piece }
Expand Down

0 comments on commit 4264c08

Please sign in to comment.