You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fbc/index.html

20 lines
802 B
HTML

<!DOCTYPE html>
<link href="index.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
<script>
const converter = new showdown.Converter();
const text = fetch('_INDEX.md').then(response => response.text()).then(text => {
document.getElementById('content').innerHTML = converter.makeHtml(text);
for (const header of ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']) {
const headerElements = Array.from(document.querySelectorAll(header));
for (const headerElement of headerElements) {
const link = document.createElement('a');
link.href = '#' + headerElement.id;
link.textContent = headerElement.textContent;
headerElement.innerHTML = '';
headerElement.appendChild(link);
}
}
});
</script>
<div id="content"></div>