File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ export function preprocessReadme(opts: Partial<PreprocessReadmeOptions>): Pick<P
4444 highlight ( source , lang , attrs ) {
4545 if ( lang === "svelte" ) {
4646 const noEval = / n o - e v a l / . test ( attrs ) ;
47+ const noDisplay = / n o - d i s p l a y / . test ( attrs ) ;
4748 const { instance } = parse ( source ) ;
4849
4950 if ( instance !== undefined && ! noEval ) {
@@ -66,7 +67,7 @@ export function preprocessReadme(opts: Partial<PreprocessReadmeOptions>): Pick<P
6667 } ) ;
6768 const svelteCode = Prism . highlight ( formattedCode , Prism . languages . svelte , "svelte" ) ;
6869 return `<pre class="language-${ lang } " ${
69- noEval ? "" : `data-svelte="${ modifiedSource } "`
70+ noEval || noDisplay ? "" : `data-svelte="${ modifiedSource } "`
7071 } >{@html \`${ svelteCode } \`}</pre>`;
7172 }
7273
Original file line number Diff line number Diff line change @@ -70,7 +70,6 @@ Second script block:
7070<script>
7171 import Button from "my-svelte-component";
7272
73-
7473 let toggled; /** comment */
7574</script>
7675
@@ -92,7 +91,7 @@ Second script block:
9291 import { onMount } from "svelte";
9392
9493 onMount(() => {
95- console.log(' eval')
94+ console.log(" eval");
9695 });
9796</script>
9897
@@ -103,7 +102,18 @@ Second script block:
103102 import { onMount } from "svelte";
104103
105104 onMount(() => {
106- document.title = 'title';
105+ document.title = "title";
106+ });
107+ </script>
108+
109+ ```
110+
111+ ``` svelte no-display
112+ <script>
113+ import { onMount } from "svelte";
114+
115+ onMount(() => {
116+ console.log("eval no display");
107117 });
108118</script>
109119
You can’t perform that action at this time.
0 commit comments