diff --git a/asciidoc_testdoc.adoc b/asciidoc_testdoc.adoc index b0dbdd4..bf8e8d6 100644 --- a/asciidoc_testdoc.adoc +++ b/asciidoc_testdoc.adoc @@ -318,10 +318,6 @@ stop `$[ x^n + y^n = z^n \]$` and `$[\sqrt{x^2+1}\]$` and `$\color{blue}{X \sim Normal \; (\mu,\sigma^2)}$` -== LaTeX outside of code - -This is a latex code block $$\mathbb{N} = \{ a \in \mathbb{Z} : a > 0 \}$$ and another that is an inline latex $\color{green}{X \sim Normal \; (\mu,\sigma^2)}$ and should be green - == Footnotes Here's a simple footnote,footnote:[This is the first footnote.] and here's a longer one.footnote:[Here's one with multiple paragraphs and code.] diff --git a/src/post-processor.ts b/src/post-processor.ts index 052311e..3127cc3 100644 --- a/src/post-processor.ts +++ b/src/post-processor.ts @@ -208,7 +208,7 @@ export function postProcess(html: string, options: ParserOptions, skipWikilinksA const youtubeVideoTagRegex = /]+src="(https?:\/\/(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]+))"[^>]*>[\s\S]*?<\/video>/gi; processed = processed.replace(youtubeVideoTagRegex, (match, url, videoId) => { const embedUrl = `https://www.youtube.com/embed/${videoId}?enablejsapi=1`; - return ``; + return ``; }); // 2. SECOND: Process YouTube links in tags @@ -217,7 +217,7 @@ export function postProcess(html: string, options: ParserOptions, skipWikilinksA processed = processed.replace(youtubeLinkRegex, (match, url, videoId) => { if (isInCodeBlock(processed.indexOf(match))) return match; const embedUrl = `https://www.youtube.com/embed/${videoId}?enablejsapi=1`; - return ``; + return ``; }); // 3. THIRD: Fix malformed YouTube iframes from AsciiDoc video:: macro @@ -226,7 +226,7 @@ export function postProcess(html: string, options: ParserOptions, skipWikilinksA const malformedYoutubeIframeRegex = /]+src="[^"]*youtube[^"]*(?:watch\?v=|shorts\/)([a-zA-Z0-9_-]+)[^"]*"[^>]*(?:\/>|>[\s\S]*?<\/iframe>)/gi; processed = processed.replace(malformedYoutubeIframeRegex, (match, videoId) => { const embedUrl = `https://www.youtube.com/embed/${videoId}?enablejsapi=1`; - return ``; + return ``; }); // 3.5: Fix YouTube iframes with embed URLs but wrong parameters or missing required attributes @@ -243,7 +243,7 @@ export function postProcess(html: string, options: ParserOptions, skipWikilinksA } // Fix the iframe with proper attributes const embedUrl = `https://www.youtube.com/embed/${videoId}?enablejsapi=1`; - return ``; + return ``; }); // 4. FOURTH: Fix any existing YouTube iframes that have malformed embed URLs (AsciiDoc sometimes creates broken embed URLs) @@ -251,7 +251,7 @@ export function postProcess(html: string, options: ParserOptions, skipWikilinksA const brokenYoutubeIframeRegex = /]+src="[^"]*youtube\.com\/embed\/[^"]*watch\?v=([a-zA-Z0-9_-]+)[^"]*"[^>]*(?:\/>|>[\s\S]*?<\/iframe>)/gi; processed = processed.replace(brokenYoutubeIframeRegex, (match, videoId) => { const embedUrl = `https://www.youtube.com/embed/${videoId}?enablejsapi=1`; - return ``; + return ``; }); // 5. LAST: Handle bare YouTube URLs (not in links, video tags, or iframes) @@ -345,7 +345,7 @@ export function postProcess(html: string, options: ParserOptions, skipWikilinksA if (youtubeMatch) { const videoId = youtubeMatch[1]; const embedUrl = `https://www.youtube.com/embed/${videoId}?enablejsapi=1`; - return ``; + return ``; } // Check Spotify URLs (be very specific - must be open.spotify.com)