Skip to content

Commit beed6b9

Browse files
committed
Add caveats to readme
1 parent dbed0a0 commit beed6b9

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

web/README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ of how we like to write docs. You can check
3131
[Docusaurus' documentation](https://docusaurus.io/docs/2.x/markdown-features) to see which special
3232
Markdown features available (e.g. line highlighting).
3333

34-
3534
#### Polyglot code blocks
3635

3736
For examples that have a JavaScript and TypeScript version, add a `auto-js` meta attribute
@@ -99,7 +98,21 @@ export const validatePassword = (password: string) => password.length > 8 && /*
9998

10099
</TabItem>
101100
</Tabs>
102-
~~~
101+
102+
##### Caveats
103+
104+
The `auto-js` and `with-hole` meta attributes are custom Docusaurus plugins that we wrote, implemented at
105+
[./src/remark/auto-js-code.ts](./src/remark/auto-js-code.ts) and [./src/remark/code-with-hole.ts](./src/remark/code-with-hole.ts).
106+
107+
`auto-js` specifically is backed by [ts-blank-space](https://github.com/bloomberg/ts-blank-space), which will _only_ remove the
108+
type annotations and not process anything else. Thus, some edge-cases can arise, so we recommend to run `npm run start` and
109+
check the output JS in the browser to see if everything looks good.
110+
111+
Known caveats are:
112+
- Run `prettier` on the code before pasting it in the document, as `auto-js` will enforce it.
113+
- Remember to add a `type` specifier to `import`s we don't want to appear in the JS
114+
- `// highlight-next-line` comment before a TS-only line will hang around and highlight the wrong line. Use `// highlight-start` and `// highlight-end` instead.
115+
- It doesn't replace file names' extensions in clarification comments (this is mostly unique to the tutorial pages).
103116

104117
### Build
105118

0 commit comments

Comments
 (0)