mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
18 lines
570 B
JavaScript
18 lines
570 B
JavaScript
async function loadNotes(file) {
|
|
const toc = [];
|
|
let hash = location.hash;
|
|
let converter = new showdown.Converter({ tables: true, extensions: [showdownToc({ toc })] } );
|
|
let text = await (await fetch(file)).text();
|
|
let content = document.getElementById('content');
|
|
content.innerHTML = converter.makeHtml(text);
|
|
|
|
if (hash) {
|
|
const link = document.createElement('a');
|
|
link.href = hash;
|
|
document.body.appendChild(link);
|
|
link.click();
|
|
document.body.removeChild(link);
|
|
}
|
|
}
|
|
|
|
window.loadNotes = loadNotes; |