Files
git.taskfile.build/_includes/layouts/base.njk
T

106 lines
3.7 KiB
Plaintext

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="/img/logo.svg">
<meta name="color-scheme" content="light dark">
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
>
<link
href="https://unpkg.com/prismjs@1.20.0/themes/prism-okaidia.css"
rel="stylesheet"
/>
<link rel="stylesheet" href="/css/style.css">
<title>
{{ renderData.title or title or metadata.title}}
</title>
<script defer data-domain="taskfile.build" src="https://plausible.io/js/script.js"></script>
</head>
<body>
<header>
</header>
<main class="container">
<nav>
<ul>
<li><strong><a class="contrast" href="/"><img width="50px" src="/img/logo.png" /> Taskfile Build</a></strong></li>
</ul>
<ul>
<li><a class="contrast" href="/">📋 Specification</a></li>
<li><a class="contrast" href="/usage/">⚡ Usage</a></li>
<li><a class="contrast" href="/patterns">🔧 Patterns</a></li>
<li><a class="contrast" href="/library">📚 Library</a></li>
<li><a class="contrast" href="/examples">📝 Examples</a></li>
</ul>
</nav>
<div class="main-content-wrapper">
<aside class="sidebar">
<div id="toc-container">
<h3>Content</h3>
<div id="toc-content"></div>
</div>
</aside>
<article class="main-content">
{{ content | safe }}
</article>
</div>
<footer>
<a href="https://codeberg.org/Mint-System/taskfile.build/_edit/main/{{ page.inputPath }}">Edit this page on Codeberg</a>
</footer>
</main>
<button id="scrollToTop" class="secondary">↑ Top</button>
<script src="/js/randomFunctionNames.js"></script>
<script>
// Extract headings and build TOC
document.addEventListener('DOMContentLoaded', function() {
const headings = document.querySelectorAll('article h1, article h2, article h3');
const tocContainer = document.getElementById('toc-content');
if (headings.length > 0) {
const tocList = document.createElement('ul');
tocList.className = 'toc-list';
headings.forEach(heading => {
const level = parseInt(heading.tagName.charAt(1));
const link = document.createElement('a');
link.href = '#' + heading.id;
// Remove anchor symbols (#) from heading text
let headingText = heading.textContent;
// Remove the anchor symbol and any surrounding whitespace
headingText = headingText.replace(/^\s*#?\s*/, '').trim();
link.textContent = headingText;
link.classList.add('contrast'); // Match the navigation style
const listItem = document.createElement('li');
listItem.className = `toc-item toc-level-${level}`;
listItem.appendChild(link);
tocList.appendChild(listItem);
});
tocContainer.appendChild(tocList);
} else {
// Hide TOC if no headings found
document.getElementById('toc-container').style.display = 'none';
}
});
const scrollToTopBtn = document.getElementById("scrollToTop");
window.addEventListener("scroll", () => {
if (window.scrollY > 300) {
scrollToTopBtn.style.display = "block";
} else {
scrollToTopBtn.style.display = "none";
}
});
scrollToTopBtn.addEventListener("click", () => {
window.scrollTo({ top: 0, behavior: "smooth" });
});
</script>
</body>
</html>