Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpablocohn committed May 25, 2024
2 parents 6f3cd2e + 667b1ae commit cfe5321
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
22 changes: 22 additions & 0 deletions openrvdas/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OpenRVDAS Documentation</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="sidebar">
<h2>Table of Contents</h2>
<ul id="toc">
<!-- TOC entries will be populated here -->
</ul>
</div>
<div class="content">
<!-- Chapters will be displayed here -->
<div id="chapter-content"></div>
</div>
<script src="script.js"></script>
</body>
</html>
43 changes: 43 additions & 0 deletions openrvdas/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
document.addEventListener("DOMContentLoaded", function () {
const toc = document.getElementById("toc");
const chapterContent = document.getElementById("chapter-content");

const chapters = [
{ title: "Quickstart", file: "quickstart.md" },
{ title: "GUI Quickstart", file: "quickstart_gui.md" },
{ title: "Introduction to Loggers", file: "intro_to_loggers.md" },
// Add more chapters as needed
];

// Populate TOC
chapters.forEach((chapter, index) => {
const li = document.createElement("li");
const a = document.createElement("a");
a.href = "#";
a.textContent = chapter.title;
a.addEventListener("click", (e) => {
e.preventDefault();
loadChapter(chapter.file);
});
li.appendChild(a);
toc.appendChild(li);
});

// Load chapter content
function loadChapter(file) {
fetch(file)
.then((response) => response.text())
.then((text) => {
chapterContent.innerHTML = marked(text);
})
.catch((error) => {
chapterContent.innerHTML = "<p>Error loading chapter.</p>";
console.error(error);
});
}

// Load the first chapter by default
if (chapters.length > 0) {
loadChapter(chapters[0].file);
}
});
45 changes: 45 additions & 0 deletions openrvdas/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
body {
display: flex;
margin: 0;
font-family: Arial, sans-serif;
}

.sidebar {
position: fixed;
top: 0;
left: 0;
width: 200px;
height: 100%;
background-color: #f4f4f4;
padding: 20px;
overflow-y: auto;
border-right: 1px solid #ccc;
}

.content {
margin-left: 220px;
padding: 20px;
flex-grow: 1;
}

h2 {
margin-top: 0;
}

ul {
list-style-type: none;
padding: 0;
}

li {
margin: 10px 0;
}

li a {
text-decoration: none;
color: #333;
}

li a:hover {
text-decoration: underline;
}

0 comments on commit cfe5321

Please sign in to comment.