docs: more cleanup following restructure (#2702)
- add TOC for Reference section - make external links use _blank to open a new tab - fix some more /gen links spots I missed, oops - add a general redirect from old /gen links → /reference - some more stylistic touchups ### Change Type - [x] `documentation` — Changes to the documentation only[^2] ### Release Notes - Docs: further cleanup following restructure.
This commit is contained in:
parent
279abff228
commit
63e3d6dfc9
13 changed files with 308 additions and 284 deletions
|
@ -62,7 +62,21 @@ export const Paragraph = (props: any) => {
|
|||
}
|
||||
|
||||
export const A = (props: any) => {
|
||||
return <a {...props} />
|
||||
const isLocalUrl = props.href.startsWith('/') || props.href.startsWith('#')
|
||||
let maybeParsedUrl
|
||||
try {
|
||||
maybeParsedUrl = isLocalUrl ? null : new URL(props.href)
|
||||
} catch (e) {
|
||||
console.error(`Invalid URL: ${props.href}`)
|
||||
}
|
||||
const derivedTarget =
|
||||
isLocalUrl ||
|
||||
maybeParsedUrl?.host.includes('tldraw.com') ||
|
||||
maybeParsedUrl?.host.includes('localhost')
|
||||
? undefined
|
||||
: '_blank'
|
||||
const target = props.target ?? derivedTarget
|
||||
return <a {...props} target={target} />
|
||||
}
|
||||
|
||||
export const Divider = (props: any) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue