Mercurial Hosting > lang
comparison src/site.js @ 9:46097e607701
romaji
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 21 Jul 2025 15:16:47 -0600 |
parents | 2b7dcf355a78 |
children | 2d4b3f003ec2 |
comparison
equal
deleted
inserted
replaced
8:2b7dcf355a78 | 9:46097e607701 |
---|---|
117 | 117 |
118 function scrollBack() { | 118 function scrollBack() { |
119 window.scrollTo( 0, lastY ); | 119 window.scrollTo( 0, lastY ); |
120 } | 120 } |
121 | 121 |
122 // requires markdown-it | |
123 function handleMarkdown() { | |
124 let converter = window.markdownit({html: true}); | |
125 let divs = document.querySelectorAll('[markdown]'); | |
126 for( let div of divs ) { | |
127 let text = div.textContent; | |
128 text = text.replace(/\{([^|}]+)\|([^|}]+)\}/g, '<ruby>$1<rt>$2</rt></ruby>'); | |
129 text = converter.render(text); | |
130 div.innerHTML = text; | |
131 div.removeAttribute('markdown'); | |
132 } | |
133 } |