Skip to content

Commit 5a15d3f

Browse files
authored
Merge branch 'master' into master
2 parents a36b558 + 976e85e commit 5a15d3f

File tree

3 files changed

+40
-19
lines changed

3 files changed

+40
-19
lines changed

README.md

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A set of components and utilities to work faster with [DatoCMS](https://www.dato
66

77
<br /><br />
88
<a href="https://www.datocms.com/">
9-
<img src="https://www.datocms.com/images/full_logo.svg" height="60">
9+
<img src="https://www.datocms.com/images/full_logo.svg" height="60">
1010
</a>
1111
<br /><br />
1212

@@ -572,7 +572,6 @@ import SyntaxHighlight from 'components/SyntaxHighlight';
572572
<StructuredText
573573
data={data.blogPost.content}
574574
customRules={[
575-
576575
// Add HTML anchors to heading levels for in-page navigation
577576
renderRule(isHeading, ({ node, children, key }) => {
578577
const HeadingTag = `h${node.level}`;
@@ -588,7 +587,7 @@ import SyntaxHighlight from 'components/SyntaxHighlight';
588587
</HeadingTag>
589588
);
590589
}),
591-
590+
592591
// Use a custom syntax highlighter component for code blocks
593592
renderRule(isCode, ({ node, key }) => {
594593
return (
@@ -600,25 +599,27 @@ import SyntaxHighlight from 'components/SyntaxHighlight';
600599
/>
601600
);
602601
}),
603-
602+
604603
// Apply different formatting to top-level paragraphs
605604
renderRule(
606605
isParagraph,
607606
({ adapter: { renderNode }, node, children, key, ancestors }) => {
608607
if (isRoot(ancestors[0])) {
609608
// If this paragraph node is a top-level one, give it a special class
610-
return renderNode('p', { key, className: 'top-level-paragraph-container-example' }, children);
609+
return renderNode(
610+
'p',
611+
{ key, className: 'top-level-paragraph-container-example' },
612+
children,
613+
);
611614
} else {
612615
// Proceed with default paragraph rendering...
613616
// return renderNode('p', { key }, children);
614617

615618
// Or even completely remove the paragraph and directly render the inner children:
616619
return children;
617620
}
618-
}
619-
)
620-
621-
621+
},
622+
),
622623
]}
623624
/>;
624625
```
@@ -636,3 +637,22 @@ Note: if you override the rules for `inline_item`, `item_link` or `block` nodes,
636637
| metaTransformer | `({ node, meta }) => Object \| null` | :x: | Transform `link` and `itemLink` meta property into HTML props | [See function](https://github.com/datocms/structured-text/blob/main/packages/generic-html-renderer/src/index.ts#L61) |
637638
| customRules | `Array<RenderRule>` | :x: | Customize how document is converted in JSX (use `renderRule()` to generate) | `null` |
638639
| renderText | `(text: string, key: string) => ReactElement \| string \| null` | :x: | Convert a simple string text into React | `(text) => text` |
640+
641+
## Development
642+
643+
This repository contains a number of demos/examples. You can use them to locally test your changes to the package with `npm link`:
644+
645+
```
646+
npm link
647+
cd examples/images-and-seo/vanilla-react
648+
npm link react-datocms
649+
npm run start
650+
```
651+
652+
Now on another terminal you can run:
653+
654+
```
655+
npm run watch
656+
```
657+
658+
This will re-compile the package everytime you make a change, and the example project will pick those changes instantly.

package-lock.json

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-datocms",
3-
"version": "1.6.7",
3+
"version": "1.6.8",
44
"types": "dist/types/index.d.ts",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",

0 commit comments

Comments
 (0)