Skip to content

Commit

Permalink
Fix REGEX
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurankv committed Feb 20, 2024
1 parent 1ec34ab commit 1f83c54
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .todo
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Features:
Inline Code:
☐ Add copy button via settings and parameter #88
☐ Add optional pandoc style marking
☐ Empty backticks followed by new line "``\n" disappear

General:
Improvements:
Expand Down
8 changes: 5 additions & 3 deletions main.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/Parsing/InlineCodeParsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ export interface InlineCodeParameters {
}

export function parseInlineCode(codeText: string): {parameters: InlineCodeParameters | null, text: string} {
const match = /^{((?:[^"'{}\\]|\\.|"([^"\\]|\\.)*"|'([^'\\]|\\.)*')*)} *?([^ ].*)$/.exec(codeText);
const match = /^{((?:[^"'{}\\]|\\.|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')*)} *?([^ ].*)$/.exec(codeText);

console.log(match);
if (typeof match?.[1] !== "undefined" && typeof match?.[2] !== "undefined") {
console.log(match);
if (match[1] === "")
return {parameters: null, text: match[2]};
else
Expand Down

0 comments on commit 1f83c54

Please sign in to comment.