File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
packages/site-kit/src/lib/markdown Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 55pnpm-lock.yaml
66.vercel
77_generated.md
8- land-110m.json
8+ land-110m.json
9+ /apps /svelte.dev /content /docs
Original file line number Diff line number Diff line change @@ -283,6 +283,24 @@ export async function render_content_markdown(
283283 // Save everything locally now
284284 snippets . save ( token . text , html ) ;
285285 }
286+
287+ // ensure that `foo`/`bar` is transformed to `foo` / `bar`
288+ // https://github.com/sveltejs/svelte.dev/pull/577
289+ const slash_index =
290+ // @ts -expect-error
291+ token . tokens ?. findIndex ( ( token ) => token . type === 'text' && token . text === '/' ) ?? - 1 ;
292+
293+ if ( slash_index !== - 1 ) {
294+ // @ts -expect-error
295+ const before = token . tokens [ slash_index - 1 ] ;
296+ // @ts -expect-error
297+ const after = token . tokens [ slash_index + 1 ] ;
298+
299+ if ( before ?. type === 'codespan' && after ?. type === 'codespan' ) {
300+ // @ts -expect-error
301+ token . tokens [ slash_index ] . raw = token . tokens [ slash_index ] . text = ' / ' ;
302+ }
303+ }
286304 } ,
287305 text ( token ) {
288306 // @ts -expect-error I think this is a bug in marked — some text tokens have children,
You can’t perform that action at this time.
0 commit comments