Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jedenzero authored Sep 25, 2024
1 parent 27b22f2 commit 408e9a2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ function search(){
}

function parse(doc){
if doc.match(/^<<[^\n>]+>>\n/){
let theme = '';
doc = doc.replace(/^<<([^\n>]+)>>\n/,(match, captured_theme)=>{
theme = captured_theme;
return '';
});
document.querySelector('#theme_default').disabled = true;

const theme_link = createElement('link');
theme_link.rel = 'stylesheet';
theme_link.href = `./themes/${theme}.css`;
document.head.appendChild(theme_link);
}
doc = marked.parse(doc);
doc = doc.replace(/<a href="([^"]+)">/g, '<a href="./?doc=$1">');
doc = doc.replace(/(?<=<a href="[^"]*)_(?=[^">]*">)/g, ' ');
Expand Down

0 comments on commit 408e9a2

Please sign in to comment.