update,
This commit is contained in:
52
_docs/_layouts/foam.html
Normal file
52
_docs/_layouts/foam.html
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
<script type="text/javascript">
|
||||
// NOTE: this should be in sync with the settings/usage in the vscode extension
|
||||
// atm it's just a wide superset of md extensions to cover a wide range of cases
|
||||
var MD_EXT = ['.md', '.markdown', '.mdx', '.mdown', '.mkdn', '.mkd', '.mdwn', '.mdtxt', '.mdtext', '.text', '.Rmd'];
|
||||
function normalizeMdLink(link) {
|
||||
var url = new URL(link);
|
||||
var mdFileExt = MD_EXT.find(ext => url.pathname.endsWith(ext));
|
||||
if (mdFileExt) {
|
||||
url.pathname = url.pathname.slice(0, mdFileExt.length * -1);
|
||||
}
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
document
|
||||
.querySelectorAll(".markdown-body a[title]:not([href^=http])")
|
||||
.forEach((a) => {
|
||||
// filter to only wikilinks
|
||||
var prev = a.previousSibling;
|
||||
var next = a.nextSibling;
|
||||
if (
|
||||
prev instanceof Text && prev.textContent.endsWith('[') &&
|
||||
next instanceof Text && next.textContent.startsWith(']')
|
||||
) {
|
||||
|
||||
// remove surrounding brackets
|
||||
prev.textContent = prev.textContent.slice(0, -1);
|
||||
next.textContent = next.textContent.slice(1);
|
||||
|
||||
// add CSS list for styling
|
||||
a.classList.add('wikilink');
|
||||
|
||||
// replace page-link with "Page Title"...
|
||||
a.innerText = a.title;
|
||||
|
||||
// ...and normalize the links to allow html pages navigation
|
||||
a.href = normalizeMdLink(a.href);
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelectorAll(".github-only").forEach((el) => {
|
||||
el.remove();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
{{ content }}
|
16
_docs/_layouts/home.html
Normal file
16
_docs/_layouts/home.html
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
layout: foam
|
||||
---
|
||||
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
{{ content }}
|
||||
|
||||
<script>
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
var duplicateHeading = document.querySelector("h1:not(#foam)");
|
||||
if (duplicateHeading && duplicateHeading.remove) {
|
||||
duplicateHeading.remove();
|
||||
}
|
||||
});
|
||||
</script>
|
15
_docs/_layouts/mathjax.html
Normal file
15
_docs/_layouts/mathjax.html
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
layout: foam
|
||||
---
|
||||
|
||||
{{ content }}
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
tex2jax: {
|
||||
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
|
||||
inlineMath: [['$','$']]
|
||||
}
|
||||
});
|
||||
</script>
|
5
_docs/_layouts/page.html
Normal file
5
_docs/_layouts/page.html
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
layout: foam
|
||||
---
|
||||
|
||||
{{ content }}
|
Reference in New Issue
Block a user