Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

use src yaml files in Docusaurus 'Edit this page' links for generated doc pages

Mohamed ElSaadany3b0a936b6dcd
diff --git a/web/ReferenceGenerator.ts b/web/ReferenceGenerator.ts
index 392295d9b6a..4bd49285d3e 100644
--- a/web/ReferenceGenerator.ts
+++ b/web/ReferenceGenerator.ts
@@ -51,7 +51,7 @@ async function gen(inputFileName, outputDir) {
// Index Page
const indexFilename = outputDir + `/index.mdx`
- const index = generateDocsIndexPage(docSpec)
+ const index = generateDocsIndexPage(docSpec, inputFileName)
await writeToDisk(indexFilename, index)
console.log('The index was saved: ', indexFilename)
@@ -70,6 +70,7 @@ async function gen(inputFileName, outputDir) {
const content = Page({
slug,
id: slug,
+ specFileName: inputFileName,
title: pageSpec.title || pageSpec.pageName,
description,
parameters: hasTsRef ? generateParameters(tsDefinition) : '',
@@ -156,7 +157,7 @@ const methodListItemLabel = ({ name, isOptional, type, description }, subContent
<div class="method-list-item-description">
${description ? description : 'No description provided. '}
-
+
</div>
${subContent}
</li>
@@ -244,11 +245,12 @@ function generateSidebar(docSpec: any) {
return Sidebar(categories)
}
-function generateDocsIndexPage(docSpec: any) {
+function generateDocsIndexPage(docSpec: any, inputFileName: string) {
return Page({
slug: slugify(docSpec.info.title),
id: 'index',
title: docSpec.info.title,
+ specFileName: inputFileName,
description: docSpec.info.description,
})
}
diff --git a/web/spec/gen/components/Page.ts b/web/spec/gen/components/Page.ts
index 87fe1f05763..4de66e99c5f 100644
--- a/web/spec/gen/components/Page.ts
+++ b/web/spec/gen/components/Page.ts
@@ -1,7 +1,10 @@
+const EDIT_BASE_URL = 'https://github.com/supabase/supabase/edit/master/web';
+
type PageParmas = {
id: string
title: string
slug: string
+ specFileName: string
description?: string
parameters?: string
examples?: string[]
@@ -15,6 +18,7 @@ const Page = ({
id,
title,
slug,
+ specFileName,
description = '',
parameters = '',
examples = [],
@@ -28,6 +32,7 @@ const Page = ({
id: ${id}
title: "${title}"
slug: ${slug}
+custom_edit_url: ${EDIT_BASE_URL}/${specFileName}
---
import Tabs from '@theme/Tabs';
@@ -59,4 +64,4 @@ ${examples.join(`\n\n`)}
`.trim()
-export default Page
\ No newline at end of file
+export default Page