mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
Merge pull request #14701 from nrayburn-tech/fix/docs-markdown-example-code-replace
Fix example code markdown replacement
This commit is contained in:
1 file changed
+8
-11
@@ -114,7 +114,13 @@ const RefFunctionSection: React.FC<IRefFunctionSection> = (props) => {
|
||||
>
|
||||
{item.examples &&
|
||||
item.examples.map((example, exampleIndex) => {
|
||||
const exampleString = ''
|
||||
const exampleString =
|
||||
'' +
|
||||
(example.code &&
|
||||
example.code
|
||||
.trim()
|
||||
.replace(/^```.*/, '')
|
||||
.replace(/```$/, ''))
|
||||
|
||||
const codeBlockLang = example?.code?.startsWith('```js')
|
||||
? 'js'
|
||||
@@ -133,7 +139,6 @@ const RefFunctionSection: React.FC<IRefFunctionSection> = (props) => {
|
||||
// // Create a single supabase client for interacting with your database
|
||||
// const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
|
||||
// `
|
||||
const currentExampleId = example.id
|
||||
const staticExample = item.examples[exampleIndex]
|
||||
|
||||
const response = staticExample.response
|
||||
@@ -152,15 +157,7 @@ const RefFunctionSection: React.FC<IRefFunctionSection> = (props) => {
|
||||
language={codeBlockLang}
|
||||
hideLineNumbers={true}
|
||||
>
|
||||
{exampleString +
|
||||
(example.code &&
|
||||
example.code
|
||||
.replace(/```/g, '')
|
||||
.replace('js', '')
|
||||
.replace('ts', '')
|
||||
.replace('dart', '')
|
||||
.replace('c#', '')
|
||||
.replace('kotlin', ''))}
|
||||
{exampleString}
|
||||
</CodeBlock>
|
||||
|
||||
{((tables && tables.length > 0) || sql) && (
|
||||
|
||||
Reference in new issue
Block a user