Skip to content

Commit

Permalink
allow (and properly style) code blocks in headings
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm committed Oct 10, 2024
1 parent b49c510 commit 1501e5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions apps/svelte.dev/src/routes/docs/[...path]/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
.page :global(:where(h2, h3) code) {
all: unset;
font-family: var(--sk-font-mono);
}
@media (min-width: 832px) {
Expand Down
5 changes: 1 addition & 4 deletions packages/site-kit/src/lib/markdown/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,7 @@ export async function render_content_markdown(
headings[depth - 1] = slugify(raw);
headings.length = depth;
const slug = headings.filter(Boolean).join('-');
return `<h${depth} id="${slug}">${text.replace(
/<\/?code>/g,
''
)}<a href="#${slug}" class="permalink"><span class="visually-hidden">permalink</span></a></h${depth}>`;
return `<h${depth} id="${slug}">${text}<a href="#${slug}" class="permalink"><span class="visually-hidden">permalink</span></a></h${depth}>`;
},
code({ text }) {
return snippets.get(text);
Expand Down

0 comments on commit 1501e5b

Please sign in to comment.