The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix rendering of code blocks in TOC
Joshen Lim33efe5bef5d6
diff --git a/apps/docs/components/TableOfContents.tsx b/apps/docs/components/TableOfContents.tsxindex 5bece943ad6..c2ddb5b96ee 100644--- a/apps/docs/components/TableOfContents.tsx+++ b/apps/docs/components/TableOfContents.tsx@@ -21,6 +21,25 @@ const formatSlug = (slug: string) => {return slug}+const formatTOCHeader = (content: string) => {+ let begin = false+ const res = []+ for (const x of content) {+ if (x === '`') {+ if (!begin) {+ begin = true+ res.push(`<code class="text-xs border rounded bg-scale-400 border-scale-500">`)+ } else {+ begin = false+ res.push(`</code>`)+ }+ } else {+ res.push(x)+ }+ }+ return res.join('')+}+const TableOfContents: FC<Props> = ({ toc }) => {// [Joshen] markdown-toc doesn't seem to read maxdepth from the options passed in// Our first level headers will be H2s (H1 is ignored), and we only show up to H3@@ -35,9 +54,8 @@ const TableOfContents: FC<Props> = ({ toc }) => {<ahref={`#${formatSlug(item.slug)}`}className="text-scale-1000 hover:text-brand-900 transition-colors"- >- {removeAnchor(item.content)}- </a>+ dangerouslySetInnerHTML={{ __html: formatTOCHeader(removeAnchor(item.content)) }}+ /></li>)})}