tldraw/apps/docs/scripts/functions
alex 012e54959d
Inline documentation links in type excerpts (#3931)
Before: 
<img width="667" alt="Screenshot 2024-06-12 at 15 54 38"
src="https://github.com/tldraw/tldraw/assets/1489520/3a5fc43c-fa2e-4b08-8e8b-c1c66decf7fa">

After: 
<img width="654" alt="Screenshot 2024-06-12 at 15 55 10"
src="https://github.com/tldraw/tldraw/assets/1489520/8c8abcaa-f156-4be4-a5e9-d1a4eff39ff4">

Previously, when items in our documentation referred to each other in
code snippets, we'd put the links to their documentation pages in a
separate "references" section at the bottom of the docs. Generally I
find that this makes links harder to find (they're not in-context) and
adds a fair bit of visual noise to our API documentation.

This diff moves those links inline by adding a post-processing step to
our highlighted code. This is slightly more involved than I wanted it to
be (see the comments in code.tsx for an explanation of why) but it gets
the job done. I've added small link icons next to linked code items - i
experimented with underlines and a 🔗 icon too, but this seemed to look
the best.

### Change Type

- [x] `docs` — Changes to the documentation, examples, or templates.
- [x] `improvement` — Improving existing features
2024-06-13 13:47:13 +00:00
..
checkBrokenLinks.ts [docs] design shuffle (#2951) 2024-02-29 16:28:45 +00:00
connect.ts Don't check api.json files into git (#3565) 2024-04-24 15:58:26 +00:00
createApiMarkdown.ts Better generated docs for react components (#3930) 2024-06-13 13:09:27 +00:00
fetchApiSource.ts fix docs build (#3201) 2024-03-18 15:59:29 +00:00
fetchReleases.ts Better generated docs for react components (#3930) 2024-06-13 13:09:27 +00:00
generateApiContent.ts docs: rework docs site to have different sections (#2686) 2024-01-30 14:19:25 +00:00
generateContent.ts docs: rework docs site to have different sections (#2686) 2024-01-30 14:19:25 +00:00
generateExamplesContent.ts Add image annotator example (#3147) 2024-03-19 11:41:25 +00:00
generateSection.ts side effects reference docs & examples (#3258) 2024-03-26 18:38:19 +00:00
getApiMarkdown.ts Inline documentation links in type excerpts (#3931) 2024-06-13 13:47:13 +00:00
getVectorDbStats.ts Add docs (#2470) 2024-01-15 12:33:15 +00:00
package-list.ts Add docs (#2470) 2024-01-15 12:33:15 +00:00
refreshContent.ts Don't check api.json files into git (#3565) 2024-04-24 15:58:26 +00:00