Skip to content

Commit

Permalink
Fix blockquote rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanoverna committed Jul 23, 2024
1 parent 704b3de commit 1d3984d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"csstype": "^3.1.3",
"datocms-structured-text-generic-html-renderer": "^2.0.4",
"datocms-structured-text-generic-html-renderer": "^2.1.12",
"doctoc": "^2.0.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-svelte": "^2.35.1",
Expand All @@ -60,8 +61,7 @@
"tslib": "^2.6.2",
"typescript": "^5.0.0",
"vite": "^5.0.0",
"vitest": "^1.0.0",
"doctoc": "^2.0.0"
"vitest": "^1.0.0"
},
"type": "module",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,10 @@ exports[`StructuredText > with a dast including a sprinkle of everything > with
<!--&lt;Node&gt;-->
<footer>
some German fruithead
</footer>
</blockquote>
<!--&lt;Blockquote&gt;-->
Expand Down
19 changes: 4 additions & 15 deletions src/lib/components/StructuredText/nodes/Blockquote.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,9 @@
import type { Blockquote } from 'datocms-structured-text-utils';
export let node: Blockquote;
node;
//
// This is a hack: it's important to declare the `node` prop: all the components
// for rendering node types will receive the node at rendering time. That gives
// users of the library the freedom to write custom components with special behaviours based on the
// node specifities. But we don't use the prop in this default block, so the linter
// triggers a warning. At the same time, in Svelte there's no reliable way to disable the
// `svelte(unused-export-let)` warning.
//
// Mentioning the node like this will silence the warning.
//
// If you're building a custom component and you're gonna use the node in the component,
// you can omit this statement.
</script>

<blockquote><slot /></blockquote>
<blockquote>
<slot />
<footer>{node.attribution}</footer>
</blockquote>

0 comments on commit 1d3984d

Please sign in to comment.