Skip to content

Commit a3a253b

Browse files
committed
Merge branch 'main' of github.com:sveltejs/svelte.dev
2 parents a31ba02 + 37a4e97 commit a3a253b

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

apps/svelte.dev/src/routes/tutorial/[slug]/Sidebar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
.text :global(.filename) {
173173
background-position: 1rem 54%;
174174
background-size: 1rem 1rem;
175-
padding-left: 2.5rem;
175+
padding-left: 2.5rem !important;
176176
}
177177
178178
@media (prefers-color-scheme: dark) {

apps/svelte.dev/src/routes/tutorial/[slug]/markdown.server.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ const default_renderer = {
4242
/** @type {Record<string, string>} */
4343
const options = {};
4444

45-
let html = '';
46-
4745
let source = text
4846
.replace(/\/\/\/ (.+?)(?:: (.+))?\n/gm, (_, key, value) => {
4947
options[key] = value;
@@ -64,6 +62,14 @@ const default_renderer = {
6462
})
6563
.replace(/\*\\\//g, '*/');
6664

65+
let html = '<div class="code-block"><div class="controls">';
66+
67+
if (options.file) {
68+
html += `<span class="filename">${options.file}</span>`;
69+
}
70+
71+
html += '</div>';
72+
6773
if (lang === 'diff') {
6874
const lines = source.split('\n').map((content) => {
6975
let type = null;
@@ -78,23 +84,23 @@ const default_renderer = {
7884
};
7985
});
8086

81-
html = `<div class="code-block"><pre class="language-diff"><code>${lines
87+
html += `<pre class="language-diff"><code>${lines
8288
.map((line) => {
8389
if (line.type) return `<span class="${line.type}">${line.content}\n</span>`;
8490
return line.content + '\n';
8591
})
86-
.join('')}</code></pre></div>`;
92+
.join('')}</code></pre>`;
8793
} else {
8894
const plang = languages[/** @type {keyof languages} */ (lang)];
8995
const highlighted = plang
9096
? PrismJS.highlight(source, PrismJS.languages[plang], lang)
9197
: escape_html(source);
9298

93-
html = `<div class="code-block">${
94-
options.file ? `<span class="filename">${options.file}</span>` : ''
95-
}<pre class='language-${plang}'><code>${highlighted}</code></pre></div>`;
99+
html += `<pre class='language-${plang}'><code>${highlighted}</code></pre>`;
96100
}
97101

102+
html += '</div>';
103+
98104
return html
99105
.replace(/ {13}([^ ][^]+?) {13}/g, (_, content) => {
100106
return highlight_spans(content, 'highlight add');

packages/site-kit/src/lib/components/Text.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
display: block;
106106
flex: 1;
107107
font-family: var(--sk-font-mono);
108-
font-size: 1.2rem;
108+
font-size: var(--sk-font-size-code);
109109
font-weight: 400;
110110
padding: 0 1rem;
111111
color: var(--sk-text-2);

0 commit comments

Comments
 (0)