Skip to content

Commit 56add2a

Browse files
committed
fix
1 parent a802e2c commit 56add2a

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

assets/index.css

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,10 @@ pre {
252252
background-color: var(--header);
253253
border-radius: .25rem;
254254
line-height: 1.25rem;
255+
overflow: auto;
255256
padding: 1rem;
257+
position: relative;
258+
scrollbar-color: var(--sub) transparent;
256259
width: 100%;
257260
}
258261

@@ -296,12 +299,6 @@ p img {
296299
width: 100%;
297300
}
298301

299-
.lang {
300-
color: var(--sub);
301-
float: right;
302-
user-select: none;
303-
}
304-
305302
/** https://github.com/highlightjs/highlight.js/blob/main/src/styles/atom-one-dark.css */
306303

307304
.hljs-comment,

pages/test.mdx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,26 @@ is a second line.
101101
```js
102102
const hello = "world";
103103

104-
export default async function deez() {
105-
const amogus = "nuts";
104+
export default async function deez(amogusText) {
105+
const amogus = `Hello, ${amogusText}!`;
106106
console.log(amogus);
107107
return amogus;
108108
}
109109
```
110110

111111
```py
112112
class Test:
113-
def __init__(self):
113+
def __init__(self, text):
114114
self.hello = 5
115+
self.text = f"Hello, {text}. How are you?"
115116

116117

117118
if True:
118119
if not not True:
119120
if not False:
120-
test = Test()
121+
test = Test("Joe")
121122
print(test.hello)
123+
print(test.text)
122124
```
123125

124126
```lua
@@ -130,4 +132,9 @@ assert(getmetatable(t) == t1)
130132
function add(a, b)
131133
return a + b
132134
end
135+
136+
function main()
137+
local x = 5 + 10
138+
local y = "hello " .. "world"
139+
end
133140
```

server/render.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ export const render = (element) => {
4848
}
4949
if (element.type === "code") {
5050
const lang = element.attributes.className?.slice(9);
51-
const code = element.children[0];
5251
return lang === undefined
53-
? code
54-
: `<span class="lang">${lang}</span>${hljs.highlight(lang, code).value}`;
52+
? `<code>${element.children[0]}</code>`
53+
: hljs.highlight(lang, element.children[0]).value;
5554
}
5655
const c = element.children.reduce((a, b) => a + render(b), "");
5756
if (element.type === null) {

0 commit comments

Comments
 (0)