From 0e163f66073adc53c073627eaae1f46503797e59 Mon Sep 17 00:00:00 2001
From: Jared Vititoe
`)
- // Inline code
- .replace(/`([^`]+)`/g, '${code.trim()}$1')
- // Headings
- .replace(/^######\s(.+)$/gm, '$1
')
- .replace(/^#####\s(.+)$/gm, '$1
')
- .replace(/^####\s(.+)$/gm, '$1
')
- .replace(/^###\s(.+)$/gm, '$1
')
- .replace(/^##\s(.+)$/gm, '$1
')
- .replace(/^#\s(.+)$/gm, '$1
')
- // Bold / italic
- .replace(/\*\*\*(.+?)\*\*\*/g, '$1')
- .replace(/\*\*(.+?)\*\*/g, '$1')
- .replace(/\*(.+?)\*/g, '$1')
- .replace(/__(.+?)__/g, '$1')
- .replace(/_(.+?)_/g, '$1')
- // Links — block javascript: and data: URIs
- .replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, text, url) => {
- const safeUrl = /^(https?:\/\/|\/|#|\.\.?\/)/i.test(url) ? url : '#';
- return `${escHtml(text)}`;
- })
- // Images — block javascript: and data: URIs
- .replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (_, alt, src) => {
- const safeSrc = /^(https?:\/\/|\/|\.\.?\/)/i.test(src) ? src : '';
- return ``;
- })
- // Blockquote
- .replace(/^>\s(.+)$/gm, '
$1
')
- // Horizontal rule
- .replace(/^(-{3,}|\*{3,}|_{3,})$/gm, '
')
- // Unordered list items
- .replace(/^[-*+]\s(.+)$/gm, '${m}
`)
- // Ordered list items
- .replace(/^\d+\.\s(.+)$/gm, '
')
- .replace(/\n/g, '
');
- return `
${html}
` - .replace(/(<(?:pre|ul|ol|h[1-6]|blockquote|hr)[^>]*>)/g, '$1') - .replace(/(<\/(?:pre|ul|ol|h[1-6]|blockquote|hr)>)<\/p>/g, '$1'); - }, - - init(selector) { - document.querySelectorAll(selector).forEach(el => { - const raw = el.getAttribute('data-markdown') || el.textContent; - el.innerHTML = markdown.render(raw); - el.classList.add('lt-markdown'); - }); - }, - }; - /* ================================================================ MODULE 55 — PAGINATION lt.pagination.init(navEl, opts) @@ -3159,7 +3092,6 @@ timer, lightbox, auth, - markdown, ticketStatus, pagination, sidebarSubmenus: { init: initSidebarSubmenus },