All files / validation/constants wiki-patterns.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 0/0
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25                2x     2x     2x     2x     2x     2x  
// Wiki markup regex patterns used on the frontend.
// MUST be kept in sync with: legacy-drevo-yii/protected/components/WikiFormatter/Rules/
//
// When modifying patterns here, verify they match the legacy PHP counterparts.
// When legacy patterns change, update this file accordingly.
 
// Synced with: HeaderRule.php — /===(.+?)===|==(.+?)==/u
// Group 1: h3 content (if matched), Group 2: h2 content (if matched)
export const WIKI_HEADING_REGEX = /===(.+?)===|==(.+?)==/gu;
 
// Synced with: WikiFormatter::INTERNAL_LINK_PATTERN — /\(\((?!\()(.+?)\)\)(?!\))/u
export const WIKI_LINK_REGEX = /\(\((?!\()(.+?)\)\)(?!\))/gu;
 
// Synced with: InlineRules.php — /\*([^\s*\r\n](?:[^*\r\n]*[^\s*\r\n])?)\*/u (bold)
export const WIKI_BOLD_REGEX = /\*([^\s*\r\n](?:[^*\r\n]*[^\s*\r\n])?)\*/gu;
 
// Synced with: InlineRules.php — /_([^\s_\r\n](?:[^_\r\n]*[^\s_\r\n])?)_/u (italic)
export const WIKI_ITALIC_REGEX = /_([^\s_\r\n](?:[^_\r\n]*[^\s_\r\n])?)_/gu;
 
// Synced with: FootnoteRule.php — /\[\[(.+?)\]\]/smu
export const WIKI_FOOTNOTE_REGEX = /\[\[([\s\S]+?)\]\]/gu;
 
// Synced with: WikiFormatter::PICTURE_MARKER_PATTERN — /@(-?\d+)@/
export const WIKI_PICTURE_MARKER_REGEX = /@(-?\d+)@/g;