Skip to content

Commit 9ac2cce

Browse files
committed
Element ID name revision
1 parent eefe471 commit 9ac2cce

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

compile-markdown.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ let mainHtml = await marked.parse(readFile(input), {
156156
// Add copy button to code block.
157157
token.text = /* HTML */ `
158158
<div class="copy-code">
159-
<sl-copy-button from="dei-codeblock${counter}.innerText">
159+
<sl-copy-button from="codeblock-no${counter}.innerText">
160160
<sl-icon
161161
slot="copy-icon"
162162
name="clipboard-fill"
@@ -175,7 +175,7 @@ let mainHtml = await marked.parse(readFile(input), {
175175
`;
176176

177177
token.text = token.text.replace(/<code>/, /* HTML */ `
178-
<code id="dei-codeblock${counter}">
178+
<code id="codeblock-no${counter}">
179179
`.trim());
180180

181181
counter++;
@@ -260,7 +260,7 @@ for (const [_, category] of Object.entries(categories)) {
260260
// Current file, highlighted in bold.
261261
if (input === file.path) {
262262
navHtml += /* HTML */ `
263-
<li id="dei-currentpage">
263+
<li id="current-page">
264264
<b>${removeHtml(file.title)}</b>
265265
<br>
266266
</li>

src/main.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@
3535
<!-- Toolbar -->
3636
<div class="toolbar">
3737
<!-- Back to top button -->
38-
<sl-button id="dei-backtotop" style="display: none" pill>
38+
<sl-button id="back-to-top" style="display: none" pill>
3939
<sl-icon name="arrow-up"></sl-icon>
4040
</sl-button>
4141

4242
<!-- Theme selection -->
4343
<sl-dropdown>
4444
<sl-button slot="trigger" pill caret>
45-
<sl-icon id="dei-themeicon" name="moon-fill"></sl-icon>
45+
<sl-icon id="theme-icon" name="moon-fill"></sl-icon>
4646
</sl-button>
4747

48-
<sl-menu id="dei-thememenu">
48+
<sl-menu id="theme-menu">
4949
<sl-menu-item value="system">
5050
<sl-icon slot="prefix" name="circle-half"></sl-icon> System theme
5151
</sl-menu-item>

src/main.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Sets and applies a theme site-wide.
1414
function setTheme(theme) {
1515
const html = document.documentElement;
16-
const themeIcon = document.getElementById("dei-themeicon");
16+
const themeIcon = document.getElementById("theme-icon");
1717

1818
// Save theme setting.
1919
localStorage.setItem("theme", theme);
@@ -38,7 +38,7 @@ function setTheme(theme) {
3838

3939
// Open sidebar button.
4040
(function() {
41-
const sidebarButton = document.getElementById("dei-openaside");
41+
const sidebarButton = document.getElementById("open-aside");
4242
if (!sidebarButton) {
4343
return;
4444
}
@@ -64,7 +64,7 @@ function setTheme(theme) {
6464

6565
// Back-to-top button.
6666
(function() {
67-
const backToTop = document.getElementById("dei-backtotop");
67+
const backToTop = document.getElementById("back-to-top");
6868

6969
// On scroll, display/hide the button.
7070
document.addEventListener("scroll", () => {
@@ -84,7 +84,7 @@ function setTheme(theme) {
8484

8585
// Theme selection menu.
8686
(function() {
87-
const themeMenu = document.getElementById("dei-thememenu");
87+
const themeMenu = document.getElementById("theme-menu");
8888

8989
// On theme selected, update theme.
9090
themeMenu.addEventListener("sl-select", (event) => {
@@ -110,9 +110,9 @@ function setTheme(theme) {
110110
// Search functionality.
111111
(function() {
112112
// Fetch elements.
113-
const searchInput = document.getElementById("dei-searchinput");
114-
const navMain = document.getElementById("dei-navmain");
115-
const navSearch = document.getElementById("dei-navsearch");
113+
const searchInput = document.getElementById("search-input");
114+
const navMain = document.getElementById("nav-main");
115+
const navSearch = document.getElementById("nav-search");
116116

117117
if (!searchInput | !navMain || !navSearch) {
118118
return;
@@ -394,7 +394,7 @@ function setTheme(theme) {
394394
// Scroll to current page in navigation when present.
395395
window.addEventListener("load", () => {
396396
// Fetch current page in navigation; do nothing if there's none.
397-
const currentPage = document.getElementById("dei-currentpage");
397+
const currentPage = document.getElementById("current-page");
398398
if (!currentPage) {
399399
return;
400400
}

src/templates/docs.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@
2424
</div>
2525

2626
<!-- Search -->
27-
<sl-input id="dei-searchinput" placeholder="Press '/' to search" data-repo="${DOCS_REPO}" clearable pill>
27+
<sl-input id="search-input" placeholder="Press '/' to search" data-repo="${DOCS_REPO}" clearable pill>
2828
<sl-icon name="search" slot="prefix"></sl-icon>
2929
</sl-input>
3030

3131
<!-- Navigation -->
32-
<ul id="dei-navmain" class="navigation">
32+
<ul id="nav-main" class="navigation">
3333
${DOCS_NAVHTML}
3434
</ul>
35-
<ul id="dei-navsearch" class="navigation" style="display: none"></ul>
35+
<ul id="nav-search" class="navigation" style="display: none"></ul>
3636
</aside>
3737

38-
<sl-button id="dei-openaside" class="open-aside" pill>
38+
<sl-button id="open-aside" class="open-aside" pill>
3939
<sl-icon name="list"></sl-icon>
4040
</sl-button>
4141

0 commit comments

Comments
 (0)