Skip to content

Commit 8ba774d

Browse files
committed
delete tag metadata
1 parent 56add2a commit 8ba774d

File tree

3 files changed

+16
-30
lines changed

3 files changed

+16
-30
lines changed

assets/index.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ svg:hover {
125125
display: none;
126126
height: 2.5rem;
127127
width: 2.5rem;
128-
z-index: 1;
129128
}
130129

131130
@media (max-width: 72rem) {
@@ -236,9 +235,9 @@ blockquote {
236235
background-color: var(--dark);
237236
border-radius: 0 .25rem .25rem 0;
238237
border-left: .25rem solid var(--sub);
238+
color: var(--sub);
239239
margin: 0;
240240
padding-left: 1rem;
241-
color: var(--sub);
242241
}
243242

244243
li code,
@@ -254,12 +253,12 @@ pre {
254253
line-height: 1.25rem;
255254
overflow: auto;
256255
padding: 1rem;
257-
position: relative;
258256
scrollbar-color: var(--sub) transparent;
257+
scrollbar-width: thin;
259258
width: 100%;
260259
}
261260

262-
.contains-task-list {
261+
ul:has(> li input) {
263262
list-style: none;
264263
padding-left: 1rem;
265264
}

components/Footer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default render(
5555
</ul>
5656
</nav>
5757
<span>
58-
Last updated on {` <strong>${d}</strong> `}
58+
Last updated on {`<strong>${d}</strong> `}
5959
<a href="https://github.com/apacheli/apacheli.github.io">(Source)</a>
6060
</span>
6161
<span>

server/render.js

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,11 @@ const __JSX__ = (type, attributes, ...children) => ({
88

99
export default __JSX__;
1010

11-
const styleNames = {
12-
textAlign: "text-align",
13-
};
14-
15-
const _attr = (attribute) => {
16-
if (typeof attribute === "boolean") {
17-
return "";
18-
}
19-
if (typeof attribute !== "object") {
20-
return `="${attribute}"`;
21-
}
22-
let str = "";
23-
for (const key in attribute) {
24-
str += `;${styleNames[key] ?? key}:${attribute[key]}`;
25-
}
26-
return str.slice(1);
27-
};
28-
29-
const attributeNames = {
30-
"className": "class",
31-
};
11+
const attributeNames = [
12+
"aria-",
13+
"className",
14+
"data-",
15+
];
3216

3317
export const render = (element) => {
3418
if (typeof element === "function") {
@@ -38,7 +22,7 @@ export const render = (element) => {
3822
return "";
3923
}
4024
if (typeof element !== "object") {
41-
return `${element}`;
25+
return `${element}`.replace(/\n/g, " ");
4226
}
4327
if (Array.isArray(element)) {
4428
return element.reduce((a, b) => a + render(b), "");
@@ -50,16 +34,19 @@ export const render = (element) => {
5034
const lang = element.attributes.className?.slice(9);
5135
return lang === undefined
5236
? `<code>${element.children[0]}</code>`
53-
: hljs.highlight(lang, element.children[0]).value;
37+
: hljs.highlight(lang, element.children[0].slice(0, -1)).value;
5438
}
5539
const c = element.children.reduce((a, b) => a + render(b), "");
5640
if (element.type === null) {
5741
return c;
5842
}
5943
let attributes = "";
6044
for (const attribute in element.attributes) {
61-
const b = _attr(element.attributes[attribute]);
62-
attributes += ` ${attributeNames[attribute] ?? attribute}${b}`;
45+
if (attributeNames.some((a) => attribute.startsWith(a))) {
46+
continue;
47+
}
48+
const a = element.attributes[attribute];
49+
attributes += ` ${attribute}${typeof a === "boolean" ? "" : `="${a}"`}`;
6350
}
6451
return `<${element.type}${attributes}>${c && `${c}</${element.type}>`}`;
6552
};

0 commit comments

Comments
 (0)