Skip to content

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

Update all code block title prop to remove double quotes

Joshen Lim05af88ca4012
diff --git a/apps/docs/components/ButtonCard.tsx b/apps/docs/components/ButtonCard.tsx
index 481a5746cce..aa37f19f571 100644
--- a/apps/docs/components/ButtonCard.tsx
+++ b/apps/docs/components/ButtonCard.tsx
@@ -1,15 +1,24 @@
-import React from 'react'
+import React, { FC, ReactNode } from 'react'
import Link from 'next/link'
import Image from 'next/image'
-export default function ButtonCard({
+interface Props {
+ title: string
+ description?: string
+ to: string
+ icon?: string | ReactNode
+ children?: ReactNode
+ layout: 'vertical' | 'horizontal'
+}
+
+const ButtonCard: FC<Props> = ({
children = undefined,
icon = undefined,
title,
description = '',
to,
layout = 'vertical',
-}) {
+}) => {
return (
<Link href={to}>
<a
@@ -42,3 +51,5 @@ export default function ButtonCard({
</Link>
)
}
+
+export default ButtonCard
diff --git a/apps/docs/components/CodeBlock/CodeBlock.tsx b/apps/docs/components/CodeBlock/CodeBlock.tsx
index 32450a02aec..71b89056de2 100644
--- a/apps/docs/components/CodeBlock/CodeBlock.tsx
+++ b/apps/docs/components/CodeBlock/CodeBlock.tsx
@@ -65,8 +65,8 @@ const CodeBlock: FC<Props> = ({
return (
<div className="relative my-2">
{title && (
- <div className="rounded-t-md bg-scale-300 py-2 px-4 border-b border-scale-500 text-blue-1100">
- {title}
+ <div className="rounded-t-md bg-scale-300 py-2 px-4 border-b border-scale-500 text-blue-1100 font-sans">
+ {title.replace(/%20/g, ' ')}
</div>
)}
{className ? (
diff --git a/apps/docs/components/index.tsx b/apps/docs/components/index.tsx
index 83fd0379efd..967c94e5007 100644
--- a/apps/docs/components/index.tsx
+++ b/apps/docs/components/index.tsx
@@ -47,7 +47,10 @@ const components = {
{props.children}
</Heading>
),
- code: (props: any) => <CodeBlock {...props} />,
+ code: (props: any) => {
+ console.log('code', props)
+ return <CodeBlock {...props} />
+ },
mono: (props: any) => <code className="text-sm">{props.children}</code>,
}
diff --git a/apps/docs/docs/guides/auth/auth-helpers/auth-ui.mdx b/apps/docs/docs/guides/auth/auth-helpers/auth-ui.mdx
index 20259ec4a96..47deeed3b01 100644
--- a/apps/docs/docs/guides/auth/auth-helpers/auth-ui.mdx
+++ b/apps/docs/docs/guides/auth/auth-helpers/auth-ui.mdx
@@ -28,7 +28,7 @@ npm install @supabase/supabase-js @supabase/auth-ui-react
Pass `supabaseClient` from `@supabase/supabase-js` as a prop to the component.
-```js title="/src/index.js"
+```js title=/src/index.js
import { createClient } from '@supabase/supabase-js'
import { Auth } from '@supabase/auth-ui-react'
@@ -41,19 +41,19 @@ This renders the Auth component without any styling.
We recommend using one of the predefined themes to style the UI.
Import the theme you want to use and pass it to the `appearence.theme` prop.
-```diff js title="/src/index.js"
+```js title=/src/index.js
import {
- Auth,
- // highlight-next-line
- ThemeSupa
+ Auth,
+ // highlight-next-line
+ ThemeSupa,
} from '@supabase/auth-ui-react'
const App = () => (
- <Auth
- supabaseClient={supabase}
- // highlight-next-line
- appearance={{ theme: ThemeSupa }}
- />
+ <Auth
+ supabaseClient={supabase}
+ // highlight-next-line
+ appearance={{ theme: ThemeSupa }}
+ />
)
```
@@ -72,7 +72,7 @@ There are several ways to customize Auth UI:
Auth UI comes with several themes to customize the appearance. Each predefined theme comes with at least two variations, a `default` variation, and a `dark` variation. You can switch between these themes using the `theme` prop. Import the theme you want to use and pass it to the `appearence.theme` prop.
-```js title="/src/index.js"
+```js title=/src/index.js
import { createClient } from '@supabase/supabase-js'
//highlight-next-line
import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
@@ -98,7 +98,7 @@ Currently there is only one predefined theme available, but we plan to add more.
Auth UI comes with two theme variations: `default` and `dark`. You can switch between these themes with the `theme` prop.
-```js title="/src/index.js"
+```js title=/src/index.js
import { createClient } from '@supabase/supabase-js'
import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
@@ -120,7 +120,7 @@ If you don't pass a value to `theme` it uses the `"default"` theme. You can pass
Auth UI themes can be overridden using variable tokens. See the [list of variable tokens](https://github.com/supabase-community/auth-ui/blob/main/packages/react/common/theming/Themes.tsx).
-```js title="/src/index.js"
+```js title=/src/index.js
import { createClient } from '@supabase/supabase-js'
import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
@@ -153,7 +153,7 @@ If you created your own theme, you may not need to override any of the them.
You can create your own theme by following the same structure within a `appearance.theme` property.
See the list of [tokens within a theme](https://github.com/supabase-community/auth-ui/blob/main/packages/react/common/theming/Themes.tsx).
-```js title="/src/index.js"
+```js title=/src/index.js
import { createClient } from '@supabase/supabase-js'
import { Auth } from '@supabase/auth-ui-react'
@@ -205,7 +205,7 @@ You can swich between different variations of your theme with the ["theme" prop]
You can use custom CSS classes for the following elements:
`"button"`, `"container"`, `"anchor"`, `"divider"`, `"label"`, `"input"`, `"loader"`, `"message"`.
-```js title="/src/index.js"
+```js title=/src/index.js
import { createClient } from '@supabase/supabase-js'
import { Auth } from '@supabase/auth-ui-react'
@@ -230,7 +230,7 @@ const App = () => (
You can use custom CSS inline styles for the following elements:
`"button"`, `"container"`, `"anchor"`, `"divider"`, `"label"`, `"input"`, `"loader"`, `"message"`.
-```js title="/src/index.js"
+```js title=/src/index.js
import { createClient } from '@supabase/supabase-js'
import { Auth } from '@supabase/auth-ui-react'
@@ -254,7 +254,7 @@ const App = () => (
You can use custom labels with `localization.variables`. See the [list of labels](https://github.com/supabase-community/auth-ui/blob/main/packages/react/common/lib/Localization/en.json) that can be overwritten.
-```js title="/src/index.js"
+```js title=/src/index.js
import { createClient } from '@supabase/supabase-js'
import { Auth } from '@supabase/auth-ui-react'
diff --git a/apps/docs/docs/guides/auth/auth-helpers/nextjs.mdx b/apps/docs/docs/guides/auth/auth-helpers/nextjs.mdx
index ec6220be1eb..075adea1150 100644
--- a/apps/docs/docs/guides/auth/auth-helpers/nextjs.mdx
+++ b/apps/docs/docs/guides/auth/auth-helpers/nextjs.mdx
@@ -62,7 +62,7 @@ yarn add @supabase/auth-helpers-react
Retrieve your project URL and anon key in your project's [API settings](https://app.supabase.com/project/_/settings/api) in the Dashboard to set up the following environment variables. For local development you can set them in a `.env.local` file. See an [example](https://github.com/supabase/auth-helpers/blob/main/examples/nextjs/.env.local.example).
-```bash title=".env.local"
+```bash title=.env.local
NEXT_PUBLIC_SUPABASE_URL=YOUR_SUPABASE_URL
NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
@@ -79,7 +79,7 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
Wrap your `pages/_app.js` component with the `SessionContextProvider` component:
-```jsx title="pages/_app.js"
+```jsx title=pages/_app.js
import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
import { SessionContextProvider } from '@supabase/auth-helpers-react'
@@ -104,7 +104,7 @@ function MyApp({ Component, pageProps }) {
Wrap your `pages/_app.tsx` component with the `SessionContextProvider` component:
-```tsx title="pages/_app.tsx"
+```tsx title=pages/_app.tsx
import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
// highlight-next-line
import { SessionContextProvider, Session } from '@supabase/auth-helpers-react'
@@ -233,7 +233,7 @@ export default LoginPage
Create a server supabase client to retrieve the logged in user's session:
-```jsx title="pages/profile.js"
+```jsx title=pages/profile.js
import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
export default function Profile({ user }) {
@@ -495,7 +495,7 @@ Create a server supabase client to retrieve the logged in user's session:
>
<TabPanel id="js" label="JavaScript">
-```jsx title="pages/api/protected-route.js"
+```jsx title=pages/api/protected-route.js
import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
const ProtectedRoute = async (req, res) => {
@@ -523,7 +523,7 @@ export default ProtectedRoute
</TabPanel>
<TabPanel id="ts" label="TypeScript">
-```tsx title="pages/api/protected-route.ts"
+```tsx title=pages/api/protected-route.ts
import { NextApiHandler } from 'next'
import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
@@ -556,7 +556,7 @@ export default ProtectedRoute
As an alternative to protecting individual pages you can use a [Next.js Middleware](https://nextjs.org/docs/middleware) to protect the entire directory or those that match the config object. In the following example, all requests to `/middleware-protected/*` will check whether a user is signed in, if successful the request will be forwarded to the destination route, otherwise the user will be redirected:
-```ts title="middleware.ts"
+```ts title=middleware.ts
import { createMiddlewareSupabaseClient } from '@supabase/auth-helpers-nextjs'
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
@@ -611,7 +611,7 @@ Use `createServerSupabaseClient` within your `NextApiHandler`:
>
<TabPanel id="before" label="Before">
-```tsx title="pages/api/protected-route.ts"
+```tsx title=pages/api/protected-route.ts
import { withApiAuth } from '@supabase/auth-helpers-nextjs'
export default withApiAuth(async function ProtectedRoute(req, res, supabase) {
@@ -624,7 +624,7 @@ export default withApiAuth(async function ProtectedRoute(req, res, supabase) {
</TabPanel>
<TabPanel id="after" label="After">
-```tsx title="pages/api/protected-route.ts"
+```tsx title=pages/api/protected-route.ts
import { NextApiHandler } from 'next'
import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
@@ -665,7 +665,7 @@ Use `createServerSupabaseClient` within `getServerSideProps`:
>
<TabPanel id="before" label="Before">
-```tsx title="pages/profile.tsx"
+```tsx title=pages/profile.tsx
import { withPageAuth, User } from '@supabase/auth-helpers-nextjs'
export default function Profile({ user }: { user: User }) {
@@ -678,7 +678,7 @@ export const getServerSideProps = withPageAuth({ redirectTo: '/' })
</TabPanel>
<TabPanel id="after" label="After">
-```tsx title="pages/profile.js"
+```tsx title=pages/profile.js
import { createServerSupabaseClient, User } from '@supabase/auth-helpers-nextjs'
import { GetServerSidePropsContext } from 'next'
@@ -724,7 +724,7 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
>
<TabPanel id="before" label="Before">
-```tsx title="middleware.ts"
+```tsx title=middleware.ts
import { withMiddlewareAuth } from '@supabase/auth-helpers-nextjs'
export const middleware = withMiddlewareAuth({
@@ -745,7 +745,7 @@ export const config = {
</TabPanel>
<TabPanel id="after" label="After">
-```tsx title="middleware.ts"
+```tsx title=middleware.ts
import { createMiddlewareSupabaseClient } from '@supabase/auth-helpers-nextjs'
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
diff --git a/apps/docs/docs/guides/auth/auth-helpers/remix.mdx b/apps/docs/docs/guides/auth/auth-helpers/remix.mdx
index f180f8b207f..6a914eee699 100644
--- a/apps/docs/docs/guides/auth/auth-helpers/remix.mdx
+++ b/apps/docs/docs/guides/auth/auth-helpers/remix.mdx
@@ -46,7 +46,7 @@ This library supports the following tooling versions:
Retrieve your project URL and anon key in your project's [API settings](https://app.supabase.com/project/_/settings/api) in the Dashboard to set up the following environment variables. For local development you can set them in a `.env` file. See an [example](https://github.com/supabase/auth-helpers/blob/main/examples/remix/.env.example).
-```bash title=".env"
+```bash title=.env
SUPABASE_URL=YOUR_SUPABASE_URL
SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
@@ -228,7 +228,7 @@ const user = session?.user
In order to use the Supabase client in the browser - fetching data in `useEffect` or subscribing to realtime events - we need to do a little more plumbing. Remix does not include a way to make environment variables available to the browser, so we need to pipe them through from a `loader` function in our `root.jsx` route and attach them to the `window`.
-```jsx title="app/root.jsx"
+```jsx title=app/root.jsx
export const loader = () => {
const { SUPABASE_URL, SUPABASE_ANON_KEY } = process.env
return json({
@@ -244,13 +244,13 @@ export const loader = () => {
Next, we call the `useLoaderData` hook in our component to get the `env` object.
-```jsx title="app/root.jsx"
+```jsx title=app/root.jsx
const { env } = useLoaderData()
```
And then, add a `<script>` tag to attach these environment variables to the `window`. This should be placed immediately before the `<Scripts />` component in `app/root.jsx`
-```jsx title="app/root.jsx"
+```jsx title=app/root.jsx
<script
dangerouslySetInnerHTML={{
__html: `window.env = ${JSON.stringify(env)}`,
@@ -260,7 +260,7 @@ And then, add a `<script>` tag to attach these environment variables to the `win
Full example for Node:
-```jsx title="app/root.jsx"
+```jsx title=app/root.jsx
import { json } from '@remix-run/node' // change this import to whatever runtime you are using
import {
Form,
@@ -322,7 +322,7 @@ Now we can call `createBrowserClient` in our components to fetch data client-sid
In order to use the Supabase client in the browser - fetching data in `useEffect` or subscribing to realtime events - we need to do a little more plumbing. Remix does not include a way to make environment variables available to the browser, so we need to pipe them through from a `loader` function in our `root.tsx` route and attach them to the `window`.
-```jsx title="app/root.tsx"
+```jsx title=app/root.tsx
export const loader = () => {
const { SUPABASE_URL, SUPABASE_ANON_KEY } = process.env
return json({
@@ -338,13 +338,13 @@ export const loader = () => {
Next, we call the `useLoaderData` hook in our component to get the `env` object.
-```jsx title="app/root.tsx"
+```jsx title=app/root.tsx
const { env } = useLoaderData()
```
And then, add a `<script>` tag to attach these environment variables to the `window`. This should be placed immediately before the `<Scripts />` component in `app/root.tsx`
-```jsx title="app/root.tsx"
+```jsx title=app/root.tsx
<script
dangerouslySetInnerHTML={{
__html: `window.env = ${JSON.stringify(env)}`,
@@ -354,7 +354,7 @@ And then, add a `<script>` tag to attach these environment variables to the `win
Full example for Node:
-```jsx title="app/root.tsx"
+```jsx title=app/root.tsx
import { json, MetaFunction, LoaderFunction } from '@remix-run/node' // change this import to whatever runtime you are using
import {
Form,
diff --git a/apps/docs/docs/guides/auth/auth-helpers/sveltekit.mdx b/apps/docs/docs/guides/auth/auth-helpers/sveltekit.mdx
index 55e68832c12..91883170394 100644
--- a/apps/docs/docs/guides/auth/auth-helpers/sveltekit.mdx
+++ b/apps/docs/docs/guides/auth/auth-helpers/sveltekit.mdx
@@ -52,7 +52,7 @@ PUBLIC_SUPABASE_ANON_KEY=your-anon-key
Start off by creating a `db.ts` file inside of the `src/lib` directory and instantiate the `supabaseClient`.
-```ts title="src/lib/db.ts"
+```ts title=src/lib/db.ts
import { createClient } from '@supabase/supabase-js'
import { setupSupabaseHelpers } from '@supabase/auth-helpers-sveltekit'
import { dev } from '$app/environment'
@@ -77,7 +77,7 @@ setupSupabaseHelpers({
Edit your `+layout.svelte` file and set up the client-side.
-```html title="src/routes/+layout.svelte"
+```html title=src/routes/+layout.svelte
<script lang="ts">
// make sure the supabase instance is initialized on the client
import '$lib/db'
@@ -99,7 +99,7 @@ Edit your `+layout.svelte` file and set up the client-side.
The `hooks.server.ts` file is where the heavy lifting of this library happens:
-```ts title="src/hooks.server.ts"
+```ts title=src/hooks.server.ts
// make sure the supabase instance is initialized on the server
import '$lib/db'
import { dev } from '$app/environment'
@@ -126,7 +126,7 @@ There are three handle methods available:
In order to make the session available to the UI (e.g., pages and layouts), pass the session in the root layout load function:
-```ts title="src/routes/+layout.server.ts"
+```ts title=src/routes/+layout.server.ts
import type { LayoutServerLoad } from './$types'
export const load: LayoutServerLoad = async ({ locals }) => {
@@ -140,7 +140,7 @@ export const load: LayoutServerLoad = async ({ locals }) => {
In order to get the most out of TypeScript and IntelliSense, import the types into the `app.d.ts` type definition file that comes with your SvelteKit project.
-```ts title="src/app.d.ts"
+```ts title=src/app.d.ts
/// <reference types="@sveltejs/kit" />
// See https://kit.svelte.dev/docs/types#app
@@ -164,7 +164,7 @@ This library has provided a method to delete the session cookie.
Create a server only page with an action to delete the cookie
-```ts title="src/routes/logout/+page.server.ts"
+```ts title=src/routes/logout/+page.server.ts
import { deleteSession } from '@supabase/auth-helpers-sveltekit/server'
import { redirect } from '@sveltejs/kit'
import type { Actions } from './$types'
@@ -193,7 +193,7 @@ Then make a **POST** request with a form to the server only page above.
You can now determine if a user is authenticated on the client-side by checking that the `user` object in `$page.data.session` is defined.
-```html title="src/routes/+page.svelte"
+```html title=src/routes/+page.svelte
<script>
import { page } from '$app/stores'
</script>
@@ -234,7 +234,7 @@ For [row level security](https://supabase.com/docs/learn/auth-deep-dive/auth-row
## Server-side data fetching with RLS
-```html title="src/routes/profile/+page.svelte"
+```html title=src/routes/profile/+page.svelte
<script>
/** @type {import('./$types').PageData} */
export let data
@@ -248,7 +248,7 @@ For [row level security](https://supabase.com/docs/learn/auth-deep-dive/auth-row
For [row level security](https://supabase.com/docs/learn/auth-deep-dive/auth-row-level-security) to work in a server environment, you need to use the `withAuth` helper to check if the user is authenticated. The helper extends the event with `session` and `getSupabaseClient()`:
-```ts title="src/routes/profile/+page.ts"
+```ts title=src/routes/profile/+page.ts
import type { PageLoad } from './$types';
import { withAuth } from '@supabase/auth-helpers-sveltekit';
import { redirect } from '@sveltejs/kit';
@@ -293,7 +293,7 @@ await getSupabaseClient().from('table2').select()
Wrap an API Route to check that the user has a valid session. If they're not logged in the session is `null`.
-```ts title="src/routes/api/protected-route/+server.ts"
+```ts title=src/routes/api/protected-route/+server.ts
import type { RequestHandler } from './$types';
import { withAuth } from '@supabase/auth-helpers-sveltekit';
import { json, redirect } from '@sveltejs/kit';
@@ -321,7 +321,7 @@ If you visit `/api/protected-route` without a valid session cookie, you will get
Wrap an Action to check that the user has a valid session. If they're not logged in, the session is `null`.
-```ts title="src/routes/posts/+page.server.ts"
+```ts title=src/routes/posts/+page.server.ts
import type { Actions } from './$types'
import { withAuth } from '@supabase/auth-helpers-sveltekit'
import { error, invalid } from '@sveltejs/kit'
@@ -417,7 +417,7 @@ export const actions: Actions = {
If you want to use something other than `locals.session` and `$page.data.session`, update the types and create three helper functions:
-```ts title="src/app.d.ts"
+```ts title=src/app.d.ts
declare namespace App {
interface Locals {
mySupabaseSession: import('@supabase/auth-helpers-sveltekit').SupabaseSession
@@ -428,7 +428,7 @@ declare namespace App {
}
```
-```ts title="src/hooks.server.ts"
+```ts title=src/hooks.server.ts
setupSupabaseServer({
supabaseClient,
cookieOptions: {
@@ -440,7 +440,7 @@ setupSupabaseServer({
})
```
-```ts title="src/lib/db.ts"
+```ts title=src/lib/db.ts
setupSupabaseClient({
supabaseClient,
// --- change location within pageData ---
@@ -466,7 +466,7 @@ The environment variable prefix is now `PUBLIC_` instead of `VITE_` (e.g., `VITE
>
<TabPanel id="older" label="0.6.11 and below">
-```js title="src/lib/db.ts"
+```js title=src/lib/db.ts
import { createSupabaseClient } from '@supabase/auth-helpers-sveltekit';
const { supabaseClient } = createSupabaseClient(
@@ -480,7 +480,7 @@ export { supabaseClient };
</TabPanel>
<TabPanel id="latest" label="0.7.0">
-```js title="src/lib/db.ts"
+```js title=src/lib/db.ts
import { createClient } from '@supabase/supabase-js'
import { setupSupabaseHelpers } from '@supabase/auth-helpers-sveltekit'
import { dev } from '$app/environment'
@@ -515,7 +515,7 @@ setupSupabaseHelpers({
>
<TabPanel id="older" label="0.6.11 and below">
-```html title="src/routes/__layout.svelte"
+```html title=src/routes/__layout.svelte
<script>
import { session } from '$app/stores'
import { supabaseClient } from '$lib/db'
@@ -532,7 +532,7 @@ setupSupabaseHelpers({
The `@supabase/auth-helpers-svelte` library is no longer required as the `@supabase/auth-helpers-sveltekit` library handles all the client-side code.
-```html title="src/routes/+layout.svelte"
+```html title=src/routes/+layout.svelte
<script lang="ts">
// make sure the supabase instance is initialized on the client
import '$lib/db'
@@ -563,7 +563,7 @@ The `@supabase/auth-helpers-svelte` library is no longer required as the `@supab
>
<TabPanel id="older" label="0.6.11 and below">
-```ts title="src/hooks.ts"
+```ts title=src/hooks.ts
import { handleAuth } from '@supabase/auth-helpers-sveltekit'
import type { GetSession, Handle } from '@sveltejs/kit'
import { sequence } from '@sveltejs/kit/hooks'
@@ -583,7 +583,7 @@ export const getSession: GetSession = async (event) => {
</TabPanel>
<TabPanel id="latest" label="0.7.0">
-```ts title="src/hooks.server.ts"
+```ts title=src/hooks.server.ts
// make sure the supabase instance is initialized on the server
import '$lib/db'
import { dev } from '$app/environment'
@@ -594,7 +594,7 @@ export const handle = auth()
**Optional** _if using additional handle methods_
-```ts title="src/hooks.server.ts"
+```ts title=src/hooks.server.ts
// make sure the supabase instance is initialized on the server
import '$lib/db'
import { dev } from '$app/environment'
@@ -617,7 +617,7 @@ export const handle = sequence(auth(), yourHandler)
>
<TabPanel id="older" label="0.6.11 and below">
-```ts title="src/app.d.ts"
+```ts title=src/app.d.ts
/// <reference types="@sveltejs/kit" />
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
@@ -641,7 +641,7 @@ declare namespace App {
</TabPanel>
<TabPanel id="latest" label="0.7.0">
-```ts title="src/app.d.ts"
+```ts title=src/app.d.ts
/// <reference types="@sveltejs/kit" />
// See https://kit.svelte.dev/docs/types#app
@@ -674,7 +674,7 @@ declare namespace App {
>
<TabPanel id="older" label="0.6.11 and below">
-```html title="src/routes/index.svelte"
+```html title=src/routes/index.svelte
<script>
import { session } from '$app/stores'
</script>
@@ -690,7 +690,7 @@ declare namespace App {
</TabPanel>
<TabPanel id="latest" label="0.7.0">
-```html title="src/routes/+page.svelte"
+```html title=src/routes/+page.svelte
<script>
import { page } from '$app/stores'
</script>
@@ -716,7 +716,7 @@ declare namespace App {
>
<TabPanel id="older" label="0.6.11 and below">
-```html title="src/routes/protected-route.svelte"
+```html title=src/routes/protected-route.svelte
<script lang="ts" context="module">
import { supabaseServerClient, withPageAuth } from '@supabase/auth-helpers-sveltekit'
import type { Load } from './__types/protected-page'
@@ -749,7 +749,7 @@ declare namespace App {
</TabPanel>
<TabPanel id="latest" label="0.7.0">
-```html title="src/routes/protected-route/+page.svelte"
+```html title=src/routes/protected-route/+page.svelte
<script lang="ts">
import type { PageData } from './$types'
@@ -764,7 +764,7 @@ declare namespace App {
<pre>{JSON.stringify(user, null, 2)}</pre>
```
-```ts title="src/routes/protected-route/+page.ts"
+```ts title=src/routes/protected-route/+page.ts
import { withAuth } from '@supabase/auth-helpers-sveltekit'
import { redirect } from '@sveltejs/kit'
import type { PageLoad } from './$types'
@@ -792,7 +792,7 @@ export const load: PageLoad = withAuth(async ({ session, getSupabaseClient }) =>
>
<TabPanel id="older" label="0.6.11 and below">
-```ts title="src/routes/api/protected-route.ts"
+```ts title=src/routes/api/protected-route.ts
import { supabaseServerClient, withApiAuth } from '@supabase/auth-helpers-sveltekit'
import type { RequestHandler } from './__types/protected-route'
@@ -820,7 +820,7 @@ export const GET: RequestHandler<GetOutput> = async ({ locals, request }) =>
</TabPanel>
<TabPanel id="latest" label="0.7.0">
-```ts title="src/routes/api/protected-route/+server.ts"
+```ts title=src/routes/api/protected-route/+server.ts
import type { RequestHandler } from './$types';
import { withAuth } from '@supabase/auth-helpers-sveltekit';
import { json, redirect } from '@sveltejs/kit';
diff --git a/apps/docs/docs/guides/cli/managing-environments.mdx b/apps/docs/docs/guides/cli/managing-environments.mdx
index d6de4fcaedd..c63b83ab093 100644
--- a/apps/docs/docs/guides/cli/managing-environments.mdx
+++ b/apps/docs/docs/guides/cli/managing-environments.mdx
@@ -197,7 +197,7 @@ Create the following files inside the `.github/workflows` directory:
>
<TabPanel id="ci" label="ci.yaml">
-```yaml title=".github/workflows/ci.yml"
+```yaml title=.github/workflows/ci.yml
name: CI
on:
@@ -230,7 +230,7 @@ jobs:
</TabPanel>
<TabPanel id="staging" label="staging.yaml">
-```yaml title=".github/workflows/staging.yml"
+```yaml title=.github/workflows/staging.yml
name: Deploy Migrations to Staging
on:
@@ -263,7 +263,7 @@ jobs:
</TabPanel>
<TabPanel id="production" label="production.yaml">
-```yaml title=".github/workflows/production.yml"
+```yaml title=.github/workflows/production.yml
name: Deploy Migrations to Production
on:
diff --git a/apps/docs/docs/guides/database/tables.mdx b/apps/docs/docs/guides/database/tables.mdx
index 2d79d60c5db..e6b46ce49d8 100644
--- a/apps/docs/docs/guides/database/tables.mdx
+++ b/apps/docs/docs/guides/database/tables.mdx
@@ -228,7 +228,7 @@ This loads data directly from a file into a table. There are several file format
For example, if you wanted to load a CSV file into your movies table:
-```csv title="./movies.csv"
+```csv title=./movies.csv
"The Empire Strikes Back", "After the Rebels are brutally overpowered by the Empire on the ice planet Hoth, Luke Skywalker begins Jedi training with Yoda."
"Return of the Jedi", "After a daring mission to rescue Han Solo from Jabba the Hutt, the Rebels dispatch to Endor to destroy the second Death Star."
```
diff --git a/apps/docs/docs/guides/functions/auth.mdx b/apps/docs/docs/guides/functions/auth.mdx
index da021238a02..c3a5965732b 100644
--- a/apps/docs/docs/guides/functions/auth.mdx
+++ b/apps/docs/docs/guides/functions/auth.mdx
@@ -17,7 +17,7 @@ By creating a supabase client with the auth context from the function, you can d
1. Get the user object.
2. Run queries in the context of the user with [Row Level Security (RLS)](/docs/guides/auth/row-level-security) policies enforced.
-```js title="supabase/functions/select-from-table-with-auth-rls/index.ts"
+```js title=supabase/functions/select-from-table-with-auth-rls/index.ts
import { serve } from 'https://deno.land/[email protected]/http/server.ts'
import { createClient } from 'https://esm.sh/@supabase/[email protected]'
diff --git a/apps/docs/docs/guides/hosting/docker.mdx b/apps/docs/docs/guides/hosting/docker.mdx
index 1b0ea6fa0d6..682cffd8d4f 100644
--- a/apps/docs/docs/guides/hosting/docker.mdx
+++ b/apps/docs/docs/guides/hosting/docker.mdx
@@ -84,7 +84,7 @@ We strongly [recommend](../../guides/hosting/overview#managing-your-database) th
The middleware will run with any PostgreSQL database that has logical replication enabled. The following environment variables should be updated
in the `.env` file to point to your external database:
-```env title=".env"
+```env title=.env
POSTGRES_PASSWORD=your-super-secret-and-long-postgres-password
POSTGRES_HOST=db
diff --git a/apps/docs/docs/guides/migrations/firebase-auth.mdx b/apps/docs/docs/guides/migrations/firebase-auth.mdx
index ad34949f235..6b0ed0335a6 100644
--- a/apps/docs/docs/guides/migrations/firebase-auth.mdx
+++ b/apps/docs/docs/guides/migrations/firebase-auth.mdx
@@ -16,19 +16,23 @@ Supabase provides several [tools](https://github.com/supabase-community/firebase
## Set up the migration tool {#set-up-migration-tool}
1. Clone the [firebase-to-supabase](https://github.com/supabase-community/firebase-to-supabase) repository:
- ```bash
- git clone https://github.com/supabase-community/firebase-to-supabase.git
- ```
+
+```bash
+git clone https://github.com/supabase-community/firebase-to-supabase.git
+```
+
1. In the `/auth` directory, create a file named `supabase-service.json` with the following contents:
- ```json
- {
- "host": "database.server.com",
- "password": "secretpassword",
- "user": "postgres",
- "database": "postgres",
- "port": 5432
- }
- ```
+
+```json
+{
+ "host": "database.server.com",
+ "password": "secretpassword",
+ "user": "postgres",
+ "database": "postgres",
+ "port": 5432
+}
+```
+
1. Go to the [Database settings](https://app.supabase.com/project/_/settings/database) for your project in the Supabase Dashboard.
1. Under **Connection Info**, copy the Host string and replace the entry in your `supabase-service.json` file.
1. Enter the password you used when you created your Supabase project in the `password` entry in the `supabase-service.json` file.
@@ -49,7 +53,7 @@ Supabase provides several [tools](https://github.com/supabase-community/firebase
1. At the top right of the users list, open the menu (3 dots) and click **Password hash parameters**.
1. Copy and save the parameters for `base64_signer_key`, `base64_salt_separator`, `rounds`, and `mem_cost`.
-```bash title="Sample password hash parameters"
+```bash title=Sample%20password%20hash%20parameters
hash_config {
algorithm: SCRYPT,
base64_signer_key: XXXX/XXX+XXXXXXXXXXXXXXXXX+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX==,
diff --git a/apps/docs/docs/guides/migrations/firestore-data.mdx b/apps/docs/docs/guides/migrations/firestore-data.mdx
index bed0a5fda0a..c99d5411e5f 100644
--- a/apps/docs/docs/guides/migrations/firestore-data.mdx
+++ b/apps/docs/docs/guides/migrations/firestore-data.mdx
@@ -12,19 +12,23 @@ The Firestore `collection` is "flattened" and converted to a table with basic co
## Set up the migration tool {#set-up-migration-tool}
1. Clone the [firebase-to-supabase](https://github.com/supabase-community/firebase-to-supabase) repository:
- ```bash
- git clone https://github.com/supabase-community/firebase-to-supabase.git
- ```
+
+```bash
+git clone https://github.com/supabase-community/firebase-to-supabase.git
+```
+
1. In the `/firestore` directory, create a file named `supabase-service.json` with the following contents:
- ```json
- {
- "host": "database.server.com",
- "password": "secretpassword",
- "user": "postgres",
- "database": "postgres",
- "port": 5432
- }
- ```
+
+```json
+{
+ "host": "database.server.com",
+ "password": "secretpassword",
+ "user": "postgres",
+ "database": "postgres",
+ "port": 5432
+}
+```
+
1. Go to the [Database settings](https://app.supabase.com/project/_/settings/database) for your project in the Supabase Dashboard.
1. Under **Connection Info**, copy the Host string and replace the entry in your `supabase-service.json` file.
1. Enter the password you used when you created your Supabase project in the `password` entry in the `supabase-service.json` file.
@@ -55,17 +59,17 @@ The Firestore `collection` is "flattened" and converted to a table with basic co
You can customize the way your JSON file is written using a [custom hook](#custom-hooks). A common use for this is to "flatten" the JSON file, or to split nested data into separate, related database tables. For example, you could take a Firestore document that looks like this:
-```json title="Firestore document"
+```json title=Firestore%20document
[{ "user": "mark", "score": 100, "items": ["hammer", "nail", "glue"] }]
```
And split it into two files (one table for users and one table for items):
-```json title="Users table"
+```json title=Users%20table
[{ "user": "mark", "score": 100 }]
```
-```json title="Items table"
+```json title=Items%20table
[
{ "user": "mark", "item": "hammer" },
{ "user": "mark", "item": "nail" },
@@ -181,14 +185,14 @@ module.exports = (collectionName, doc, recordCounters, writeRecord) => {
The result is two separate JSON files:
-```json title="users.json"
+```json title=users.json
[
{ "uid": "abc123", "name": "mark", "score": 100 },
{ "uid": "xyz789", "name": "chuck", "score": 9999999 }
]
```
-```json title="weapons.json"
+```json title=weapons.json
[
{ "uid": "abc123", "weapon": "toothpick" },
{ "uid": "abc123", "weapon": "needle" },
diff --git a/apps/docs/docs/guides/with-expo.mdx b/apps/docs/docs/guides/with-expo.mdx
index 62ecd484cc9..23fb04818de 100644
--- a/apps/docs/docs/guides/with-expo.mdx
+++ b/apps/docs/docs/guides/with-expo.mdx
@@ -42,7 +42,7 @@ We need the API URL and the `anon` key that you copied [earlier](#get-the-api-ke
These variables will be exposed on the browser, and that's completely fine since we have
[Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
-```ts title="lib/supabase.ts"
+```ts title=lib/supabase.ts
import AsyncStorage from '@react-native-async-storage/async-storage'
import { createClient } from '@supabase/supabase-js'
@@ -64,7 +64,7 @@ export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
Let's set up a React Native component to manage logins and sign ups.
Users would be able to sign in with their email and password.
-```tsx title="components/Auth.tsx"
+```tsx title=components/Auth.tsx
import React, { useState } from 'react'
import { Alert, StyleSheet, View } from 'react-native'
import { supabase } from '../lib/supabase'
@@ -152,7 +152,7 @@ After a user is signed in we can allow them to edit their profile details and ma
Let's create a new component for that called `Account.tsx`.
-```tsx title="components/Account.tsx"
+```tsx title=components/Account.tsx
import { useState, useEffect } from 'react'
import { supabase } from '../lib/supabase'
import { StyleSheet, View, Alert } from 'react-native'
@@ -279,7 +279,7 @@ const styles = StyleSheet.create({
Now that we have all the components in place, let's update `App.tsx`:
-```tsx title="App.tsx"
+```tsx title=App.tsx
import 'react-native-url-polyfill/auto'
import { useState, useEffect } from 'react'
import { supabase } from './lib/supabase'
@@ -335,7 +335,7 @@ expo install react-native-document-picker
Let's create an avatar for the user so that they can upload a profile photo.
We can start by creating a new component:
-```tsx title="components/Avatar.tsx"
+```tsx title=components/Avatar.tsx
import { useState, useEffect } from 'react'
import { supabase } from '../lib/supabase'
import { StyleSheet, View, Alert, Image, Button } from 'react-native'
@@ -466,7 +466,7 @@ const styles = StyleSheet.create({
And then we can add the widget to the Account page:
-```tsx title="components/Account.tsx"
+```tsx title=components/Account.tsx
// Import the new component
import Avatar from './Avatar'
diff --git a/apps/docs/docs/guides/with-flutter.mdx b/apps/docs/docs/guides/with-flutter.mdx
index 1a0762bb966..d9be16b8824 100644
--- a/apps/docs/docs/guides/with-flutter.mdx
+++ b/apps/docs/docs/guides/with-flutter.mdx
@@ -51,7 +51,7 @@ That is it on Supabase's end and the rest are platform specific settings:
For Android, add an intent-filter to enable deep linking:
-```xml title="android/app/src/main/AndroidManifest.xml"
+```xml title=android/app/src/main/AndroidManifest.xml
<manifest ...>
<!-- ... other tags -->
<application ...>
@@ -76,7 +76,7 @@ For Android, add an intent-filter to enable deep linking:
For iOS add CFBundleURLTypes to enable deep linking:
-```xml title="ios/Runner/Info.plist"
+```xml title=ios/Runner/Info.plist"
<!-- ... other tags -->
<plist>
<dict>
@@ -109,7 +109,7 @@ Now that we have deep links ready let's initialize the Supabase client inside ou
These variables will be exposed on the app, and that's completely fine since we have
[Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
-```dart title="lib/main.dart"
+```dart title=lib/main.dart
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
@@ -126,7 +126,7 @@ Future<void> main() async {
Let's also create a constant file to make it easier to use Supabase client.
We will also include an extension method declaration to call `showSnackBar` with one line of code.
-```dart title="lib/constants.dart"
+```dart title=lib/constants.dart
import 'package:flutter/material.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
@@ -154,7 +154,7 @@ extension ShowSnackBar on BuildContext {
Let's create a splash screen that will be shown to users right after they open the app.
This screen retrieves the current session and redirects the user accordingly.
-```dart title="lib/pages/splash_page.dart"
+```dart title=lib/pages/splash_page.dart
import 'package:flutter/material.dart';
import 'package:supabase_quickstart/constants.dart';
@@ -205,7 +205,7 @@ We'll use Magic Links, so users can sign in with their email without using passw
Notice that this page sets up a listener on the user's auth state using `onAuthStateChange`.
A new event will fire when the user comes back to the app by clicking their magic link, which this page can catch and redirect the user accordingly.
-```dart title="lib/pages/login_page.dart"
+```dart title=lib/pages/login_page.dart
import 'dart:async';
import 'package:flutter/foundation.dart';
@@ -303,7 +303,7 @@ class _LoginPageState extends State<LoginPage> {
After a user is signed in we can allow them to edit their profile details and manage their account.
Let's create a new widget called `account_page.dart` for that.
-```dart title="lib/pages/account_page.dart"
+```dart title=lib/pages/account_page.dart"
import 'package:flutter/material.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
import 'package:supabase_quickstart/components/avatar.dart';
@@ -438,7 +438,7 @@ class _AccountPageState extends State<AccountPage> {
Now that we have all the components in place, let's update `lib/main.dart`:
-```dart title="lib/main.dart"
+```dart title=lib/main.dart
import 'package:flutter/material.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
import 'package:supabase_quickstart/pages/account_page.dart';
@@ -531,7 +531,7 @@ Once you are done with all of the above, it is time to dive into coding.
Let's create an avatar for the user so that they can upload a profile photo.
We can start by creating a new component:
-```dart title="lib/components/avatar.dart"
+```dart title=lib/components/avatar.dart
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
@@ -627,7 +627,7 @@ class _AvatarState extends State<Avatar> {
And then we can add the widget to the Account page as well as some logic to update the `avatar_url` whenever the user uploads a new avatar.
-```dart title="lib/pages/account_page.dart"
+```dart title=lib/pages/account_page.dart
import 'package:flutter/material.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
import 'package:supabase_quickstart/components/avatar.dart';
diff --git a/apps/docs/docs/guides/with-ionic-angular.mdx b/apps/docs/docs/guides/with-ionic-angular.mdx
index 19cc27e744d..2110e427db4 100644
--- a/apps/docs/docs/guides/with-ionic-angular.mdx
+++ b/apps/docs/docs/guides/with-ionic-angular.mdx
@@ -40,7 +40,7 @@ And finally we want to save the environment variables in the `environment.ts` fi
All we need are the API URL and the `anon` key that you copied [earlier](#get-the-api-keys).
These variables will be exposed on the browser, and that's completely fine since we have [Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
-```ts title="environment.ts"
+```ts title=environment.ts
export const environment = {
production: false,
supabaseUrl: 'YOUR_SUPABASE_URL',
@@ -50,15 +50,10 @@ export const environment = {
Now that we have the API credentials in place, let's create a **SupabaseService** with `ionic g s supabase` to initialize the Supabase client and implement functions to communicate with the Supabase API.
-```ts title="src/app/supabase.service.ts"
+```ts title=src/app/supabase.service.ts
import { Injectable } from '@angular/core'
import { LoadingController, ToastController } from '@ionic/angular'
-import {
- AuthChangeEvent,
- createClient,
- Session,
- SupabaseClient,
-} from '@supabase/supabase-js'
+import { AuthChangeEvent, createClient, Session, SupabaseClient } from '@supabase/supabase-js'
import { environment } from '../environments/environment'
export interface Profile {
@@ -73,14 +68,8 @@ export interface Profile {
export class SupabaseService {
private supabase: SupabaseClient
- constructor(
- private loadingCtrl: LoadingController,
- private toastCtrl: ToastController
- ) {
- this.supabase = createClient(
- environment.supabaseUrl,
- environment.supabaseKey
- )
+ constructor(private loadingCtrl: LoadingController, private toastCtrl: ToastController) {
+ this.supabase = createClient(environment.supabaseUrl, environment.supabaseKey)
}
get user() {
@@ -99,9 +88,7 @@ export class SupabaseService {
.single()
}
- authChanges(
- callback: (event: AuthChangeEvent, session: Session | null) => void
- ) {
+ authChanges(callback: (event: AuthChangeEvent, session: Session | null) => void) {
return this.supabase.auth.onAuthStateChange(callback)
}
@@ -151,7 +138,7 @@ Create an **LoginPage** with `ionic g page login` Ionic CLI command.
> This guide will show the template inline, but the example app will have templateUrls
-```ts title="src/app/login/login.page.ts"
+```ts title=src/app/login/login.page.ts
import { Component, OnInit } from '@angular/core'
import { SupabaseService } from '../supabase.service'
@@ -173,12 +160,7 @@ import { SupabaseService } from '../supabase.service'
<form (ngSubmit)="handleLogin($event)">
<ion-item>
<ion-label position="stacked">Email</ion-label>
- <ion-input
- [(ngModel)]="email"
- name="email"
- autocomplete
- type="email"
- ></ion-input>
+ <ion-input [(ngModel)]="email" name="email" autocomplete type="email"></ion-input>
</ion-item>
<div class="ion-text-center">
<ion-button type="submit" fill="clear">Login</ion-button>
@@ -215,7 +197,7 @@ export class LoginPage implements OnInit {
After a user is signed in we can allow them to edit their profile details and manage their account.
Create an **AccountComponent** with `ionic g page account` Ionic CLI command.
-```ts title="src/app/account.component.ts"
+```ts title=src/app/account.component.ts
import { Component, OnInit } from '@angular/core'
import { Router } from '@angular/router'
import { Profile, SupabaseService } from '../supabase.service'
@@ -238,25 +220,15 @@ import { Profile, SupabaseService } from '../supabase.service'
<ion-item>
<ion-label position="stacked">Name</ion-label>
- <ion-input
- type="text"
- name="username"
- [(ngModel)]="profile.username"
- ></ion-input>
+ <ion-input type="text" name="username" [(ngModel)]="profile.username"></ion-input>
</ion-item>
<ion-item>
<ion-label position="stacked">Website</ion-label>
- <ion-input
- type="url"
- name="website"
- [(ngModel)]="profile.website"
- ></ion-input>
+ <ion-input type="url" name="website" [(ngModel)]="profile.website"></ion-input>
</ion-item>
<div class="ion-text-center">
- <ion-button fill="clear" (click)="updateProfile()"
- >Update Profile</ion-button
- >
+ <ion-button fill="clear" (click)="updateProfile()">Update Profile</ion-button>
</div>
</form>
@@ -276,10 +248,7 @@ export class AccountPage implements OnInit {
session = this.supabase.session
- constructor(
- private readonly supabase: SupabaseService,
- private router: Router
- ) {}
+ constructor(private readonly supabase: SupabaseService, private router: Router) {}
ngOnInit() {
this.getProfile()
}
@@ -322,7 +291,7 @@ export class AccountPage implements OnInit {
Now that we have all the components in place, let's update **AppComponent**:
-```ts title="src/app/app.component.ts"
+```ts title=src/app/app.component.ts
import { Component } from '@angular/core'
import { Router } from '@angular/router'
import { SupabaseService } from './supabase.service'
@@ -350,20 +319,18 @@ export class AppComponent {
Then update the **AppRoutingModule**
-```ts title="src/app/app.ts"
+```ts title=src/app/app.ts"
import { NgModule } from '@angular/core'
import { PreloadAllModules, RouterModule, Routes } from '@angular/router'
const routes: Routes = [
{
path: '/',
- loadChildren: () =>
- import('./login/login.module').then((m) => m.LoginPageModule),
+ loadChildren: () => import('./login/login.module').then((m) => m.LoginPageModule),
},
{
path: 'account',
- loadChildren: () =>
- import('./account/account.module').then((m) => m.AccountPageModule),
+ loadChildren: () => import('./account/account.module').then((m) => m.AccountPageModule),
},
]
@@ -408,7 +375,7 @@ Ionic PWA elements is a companion package that will polyfill certain browser API
With those packages installed we can update our `main.ts` to include an additional bootstapping call for the Ionic PWA Elements.
-```ts title="src/main.ts"
+```ts title=src/main.ts
import { enableProdMode } from '@angular/core'
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
@@ -432,7 +399,7 @@ Then create an **AvatarComponent** with this Ionic CLI command:
ionic g component avatar --module=/src/app/account/account.module.ts --create-module
```
-```ts title="src/app/avatar.component.ts"
+```ts title=src/app/avatar.component.ts
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'
import { SupabaseService } from '../supabase.service'
@@ -492,19 +459,14 @@ export class AvatarComponent implements OnInit {
@Output() upload = new EventEmitter<string>()
- constructor(
- private readonly supabase: SupabaseService,
- private readonly dom: DomSanitizer
- ) {}
+ constructor(private readonly supabase: SupabaseService, private readonly dom: DomSanitizer) {}
ngOnInit() {}
async downloadImage(path: string) {
try {
const { data } = await this.supabase.downLoadImage(path)
- this._avatarUrl = this.dom.bypassSecurityTrustResourceUrl(
- URL.createObjectURL(data)
- )
+ this._avatarUrl = this.dom.bypassSecurityTrustResourceUrl(URL.createObjectURL(data))
} catch (error) {
console.error('Error downloading image: ', error.message)
}
@@ -519,14 +481,9 @@ export class AvatarComponent implements OnInit {
const file = await fetch(photo.dataUrl)
.then((res) => res.blob())
- .then(
- (blob) =>
- new File([blob], 'my-file', { type: `image/${photo.format}` })
- )
+ .then((blob) => new File([blob], 'my-file', { type: `image/${photo.format}` }))
- const fileName = `${Math.random()}-${new Date().getTime()}.${
- photo.format
- }`
+ const fileName = `${Math.random()}-${new Date().getTime()}.${photo.format}`
await loader.present()
await this.supabase.uploadAvatar(fileName, file)
@@ -545,7 +502,7 @@ export class AvatarComponent implements OnInit {
And then we can add the widget on top of the **AccountComponent** html template:
-```ts title="src/app/account.component.ts"
+```ts title=src/app/account.component.ts
template: `
<ion-header>
<ion-toolbar>
diff --git a/apps/docs/docs/guides/with-ionic-react.mdx b/apps/docs/docs/guides/with-ionic-react.mdx
index a063bf737b6..eba8eea7953 100644
--- a/apps/docs/docs/guides/with-ionic-react.mdx
+++ b/apps/docs/docs/guides/with-ionic-react.mdx
@@ -39,7 +39,7 @@ npm install @supabase/supabase-js
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the `anon` key that you copied [earlier](#get-the-api-keys).
-```bash title=".env"
+```bash title=.env
REACT_APP_SUPABASE_URL=YOUR_SUPABASE_URL
REACT_APP_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
@@ -47,7 +47,7 @@ REACT_APP_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
Now that we have the API credentials in place, let's create a helper file to initialize the Supabase client. These variables will be exposed
on the browser, and that's completely fine since we have [Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
-```js title="src/supabaseClient.js"
+```js title=src/supabaseClient.js
import { createClient } from '@supabase/supabase-js'
const supabaseUrl = process.env.REACT_APP_SUPABASE_URL
@@ -60,7 +60,7 @@ export const supabase = createClient(supabaseUrl, supabaseAnonKey)
Let's set up a React component to manage logins and sign ups. We'll use Magic Links, so users can sign in with their email without using passwords.
-```jsx title="/src/pages/Login.tsx"
+```jsx title=/src/pages/Login.tsx
import { useState } from 'react';
import {
IonButton,
@@ -139,7 +139,7 @@ After a user is signed in we can allow them to edit their profile details and ma
Let's create a new component for that called `Account.tsx`.
-```jsx title="src/pages/Account.tsx"
+```jsx title=src/pages/Account.tsx
import {
IonButton,
IonContent,
@@ -293,7 +293,7 @@ export function AccountPage() {
Now that we have all the components in place, let's update `App.tsx`:
-```jsx title="src/App.tsx"
+```jsx title=src/App.tsx
import { Redirect, Route } from 'react-router-dom'
import { IonApp, IonRouterOutlet, setupIonicReact } from '@ionic/react'
import { IonReactRouter } from '@ionic/react-router'
@@ -369,7 +369,7 @@ Ionic PWA elements is a companion package that will polyfill certain browser API
With those packages installed we can update our `index.tsx` to include an additional bootstapping call for the Ionic PWA Elements.
-```ts title="src/index.tsx"
+```ts title=src/index.tsx
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
@@ -392,7 +392,7 @@ reportWebVitals()
Then create an **AvatarComponent**.
-```jsx title="src/components/Avatar.tsx"
+```jsx title=src/components/Avatar.tsx
import { IonIcon } from '@ionic/react';
import { person } from 'ionicons/icons';
import { Camera, CameraResultType } from '@capacitor/camera';
@@ -475,7 +475,7 @@ export function Avatar({
And then we can add the widget to the Account page:
-```jsx title="src/pages/Account.tsx"
+```jsx title=src/pages/Account.tsx
// Import the new component
import { Avatar } from '../components/Avatar';
diff --git a/apps/docs/docs/guides/with-ionic-vue.mdx b/apps/docs/docs/guides/with-ionic-vue.mdx
index 4297776809a..b00a505b820 100644
--- a/apps/docs/docs/guides/with-ionic-vue.mdx
+++ b/apps/docs/docs/guides/with-ionic-vue.mdx
@@ -44,7 +44,7 @@ npm install @supabase/supabase-js
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the `anon` key that you copied [earlier](#get-the-api-keys).
-```bash title=".env"
+```bash title=.env
VUE_APP_SUPABASE_URL=YOUR_SUPABASE_URL
VUE_APP_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
@@ -52,7 +52,7 @@ VUE_APP_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
Now that we have the API credentials in place, let's create a helper file to initialize the Supabase client. These variables will be exposed
on the browser, and that's completely fine since we have [Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
-```js title="src/supabase.ts"
+```js title=src/supabase.ts"
import { createClient } from '@supabase/supabase-js';
const supabaseUrl = process.env.VUE_APP_SUPABASE_URL as string;
@@ -65,7 +65,7 @@ export const supabase = createClient(supabaseUrl, supabaseAnonKey);
Let's set up a Vue component to manage logins and sign ups. We'll use Magic Links, so users can sign in with their email without using passwords.
-```html title="/src/views/Login.vue"
+```html title=/src/views/Login.vue
<template>
<ion-page>
<ion-header>
@@ -160,7 +160,7 @@ After a user is signed in we can allow them to edit their profile details and ma
Let's create a new component for that called `Account.vue`.
-```html title="src/views/Account.vue"
+```html title=src/views/Account.vue
<template>
<ion-page>
<ion-header>
@@ -319,7 +319,7 @@ Let's create a new component for that called `Account.vue`.
Now that we have all the components in place, let's update `App.vue` and our routes:
-```ts title="src/router.index.ts"
+```ts title=src/router.index.ts
import { createRouter, createWebHistory } from '@ionic/vue-router'
import { RouteRecordRaw } from 'vue-router'
import LoginPage from '../views/Login.vue'
@@ -345,7 +345,7 @@ const router = createRouter({
export default router
```
-```html title="src/App.vue"
+```html title=src/App.vue
<template>
<ion-app>
<ion-router-outlet />
@@ -407,7 +407,7 @@ Ionic PWA elements is a companion package that will polyfill certain browser API
With those packages installed we can update our `main.ts` to include an additional bootstapping call for the Ionic PWA Elements.
-```ts title="src/main.tsx"
+```ts title=src/main.tsx"
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
@@ -430,7 +430,7 @@ router.isReady().then(() => {
Then create an **AvatarComponent**.
-```html title="src/components/Avatar.vue"
+```html title=src/components/Avatar.vue
<template>
<div class="avatar">
<div class="avatar_wrapper" @click="uploadAvatar">
@@ -533,7 +533,7 @@ Then create an **AvatarComponent**.
And then we can add the widget to the Account page:
-```html title="src/views/Account.vue"
+```html title=src/views/Account.vue
<template>
<ion-page>
<ion-header>
diff --git a/apps/docs/docs/guides/with-nextjs.mdx b/apps/docs/docs/guides/with-nextjs.mdx
index 30122331a51..bc2674fd0cb 100644
--- a/apps/docs/docs/guides/with-nextjs.mdx
+++ b/apps/docs/docs/guides/with-nextjs.mdx
@@ -72,7 +72,7 @@ npm install @supabase/supabase-js
And finally we want to save the environment variables in a `.env.local`.
All we need are the API URL and the `anon` key that you copied [earlier](#get-the-api-keys).
-```bash title=".env.local"
+```bash title=.env.local
NEXT_PUBLIC_SUPABASE_URL=YOUR_SUPABASE_URL
NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
@@ -104,7 +104,7 @@ npm install @supabase/auth-helpers-react @supabase/auth-helpers-nextjs
Wrap your `pages/_app.js` component with the `SessionContextProvider` component:
-```jsx title="pages/_app.js"
+```jsx title=pages/_app.js
import '../styles/globals.css'
import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
import { SessionContextProvider } from '@supabase/auth-helpers-react'
@@ -129,7 +129,7 @@ export default MyApp
Wrap your `pages/_app.tsx` component with the `SessionContextProvider` component:
-```jsx title="pages/_app.tsx"
+```jsx title=pages/_app.tsx
import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
// highlight-next-line
import { SessionContextProvider, Session } from '@supabase/auth-helpers-react'
@@ -172,7 +172,7 @@ npm install @supabase/auth-ui-react
Add the `Auth` component to your home page
-```jsx title="pages/index.js"
+```jsx title=pages/index.js
import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
import { useSession, useSupabaseClient } from '@supabase/auth-helpers-react'
@@ -208,7 +208,7 @@ After a user is signed in we can allow them to edit their profile details and ma
Let's create a new component for that called `Account.js` within a `components` folder.
-```tsx title="components/Account.js"
+```tsx title=components/Account.js
import { useState, useEffect } from 'react'
import { useUser, useSupabaseClient } from '@supabase/auth-helpers-react'
@@ -324,7 +324,7 @@ export default function Account({ session }) {
Let's create a new component for that called `Account.tsx` within a `components` folder.
-```tsx title="components/Account.tsx"
+```tsx title=components/Account.tsx
import { useState, useEffect } from 'react'
import { useUser, useSupabaseClient, Session } from '@supabase/auth-helpers-react'
import { Database } from '../utils/database.types'
@@ -454,7 +454,7 @@ export default function Account({ session }: { session: Session }) {
Now that we have all the components in place, let's update `pages/index.js`:
-```jsx title="pages/index.js"
+```jsx title=pages/index.js
import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
import { useSession, useSupabaseClient } from '@supabase/auth-helpers-react'
// highlight-next-line
@@ -504,7 +504,7 @@ Let's create an avatar widget for the user so that they can upload a profile pho
>
<TabPanel id="js" label="JavaScript">
-```jsx title="components/Avatar.js"
+```jsx title=components/Avatar.js
import React, { useEffect, useState } from 'react'
import { useSupabaseClient } from '@supabase/auth-helpers-react'
@@ -596,7 +596,7 @@ export default function Avatar({ uid, url, size, onUpload }) {
</TabPanel>
<TabPanel id="ts" label="TypeScript">
-```tsx title="components/Avatar.tsx"
+```tsx title=components/Avatar.tsx
import React, { useEffect, useState } from 'react'
import { useSupabaseClient } from '@supabase/auth-helpers-react'
import { Database } from '../utils/database.types'
@@ -704,7 +704,7 @@ export default function Avatar({
And then we can add the widget to the Account page:
-```jsx title="components/Account.js"
+```jsx title=components/Account.js
// Import the new component
import Avatar from './Avatar'
diff --git a/apps/docs/docs/guides/with-nuxt-3.mdx b/apps/docs/docs/guides/with-nuxt-3.mdx
index 944a747d0f7..e6306df94c4 100644
--- a/apps/docs/docs/guides/with-nuxt-3.mdx
+++ b/apps/docs/docs/guides/with-nuxt-3.mdx
@@ -43,7 +43,7 @@ npm install @nuxtjs/supabase --save-dev
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the `anon` key that you copied [earlier](#get-the-api-keys).
-```bash title=".env"
+```bash title=.env
SUPABASE_URL="YOUR_SUPABASE_URL"
SUPABASE_KEY="YOUR_SUPABASE_ANON_KEY"
```
@@ -55,7 +55,7 @@ No need to initialize Supabase. The library will take care of it automatically.
And one optional step is to update the CSS file `assets/main.css` to make the app look nice.
You can find the full contents of this file [here](https://github.com/supabase-community/nuxt3-quickstarter/blob/main/assets/main.css).
-```typescript title="nuxt.config.ts"
+```typescript title=nuxt.config.ts
import { defineNuxtConfig } from 'nuxt'
// https://v3.nuxtjs.org/api/configuration/nuxt.config
@@ -69,7 +69,7 @@ export default defineNuxtConfig({
Let's set up a Vue component to manage logins and sign ups. We'll use Magic Links, so users can sign in with their email without using passwords.
-```html title="/components/Auth.vue"
+```html title=/components/Auth.vue
<template>
<form class="row flex-center flex" @submit.prevent="handleLogin">
<div class="col-6 form-widget">
@@ -119,7 +119,7 @@ To access the user information, use the composable [useSupabaseUser](https://sup
After a user is signed in we can allow them to edit their profile details and manage their account.
Let's create a new component for that called `Account.vue`.
-```html title="components/Account.vue"
+```html title=components/Account.vue
<template>
<form class="form-widget" @submit.prevent="updateProfile">
<div>
@@ -214,7 +214,7 @@ Let's create a new component for that called `Account.vue`.
Now that we have all the components in place, let's update `app.vue`:
-```html title="app.vue"
+```html title=app.vue
<template>
<div class="container" style="padding: 50px 0 100px 0">
<Account v-if="user" />
@@ -245,7 +245,7 @@ Every Supabase project is configured with [Storage](/docs/guides/storage) for ma
Let's create an avatar for the user so that they can upload a profile photo. We can start by creating a new component:
-```html title="components/Avatar.vue"
+```html title=components/Avatar.vue
<template>
<div>
<img
@@ -330,7 +330,7 @@ Let's create an avatar for the user so that they can upload a profile photo. We
And then we can add the widget to the Account page:
-```html title="components/Account.vue"
+```html title=components/Account.vue
<template>
<form class="form-widget" @submit.prevent="updateProfile">
<Avatar v-model:path="avatar_path" @upload="updateProfile" />
diff --git a/apps/docs/docs/guides/with-react.mdx b/apps/docs/docs/guides/with-react.mdx
index 4d2f668dd53..35285b79462 100644
--- a/apps/docs/docs/guides/with-react.mdx
+++ b/apps/docs/docs/guides/with-react.mdx
@@ -43,7 +43,7 @@ npm install @supabase/supabase-js
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the `anon` key that you copied [earlier](#get-the-api-keys).
-```bash title=".env"
+```bash title=.env
REACT_APP_SUPABASE_URL=YOUR_SUPABASE_URL
REACT_APP_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
@@ -51,7 +51,7 @@ REACT_APP_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
Now that we have the API credentials in place, let's create a helper file to initialize the Supabase client. These variables will be exposed
on the browser, and that's completely fine since we have [Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
-```js title="src/supabaseClient.js"
+```js title=src/supabaseClient.js
import { createClient } from '@supabase/supabase-js'
const supabaseUrl = process.env.REACT_APP_SUPABASE_URL
@@ -67,7 +67,7 @@ You can find the full contents of this file [here](https://raw.githubusercontent
Let's set up a React component to manage logins and sign ups. We'll use Magic Links, so users can sign in with their email without using passwords.
-```jsx title="/src/Auth.js"
+```jsx title=src/Auth.js
import { useState } from 'react'
import { supabase } from './supabaseClient'
@@ -125,7 +125,7 @@ After a user is signed in we can allow them to edit their profile details and ma
Let's create a new component for that called `Account.js`.
-```jsx title="src/Account.js"
+```jsx title=src/Account.js
import { useState, useEffect } from 'react'
import { supabase } from './supabaseClient'
@@ -239,7 +239,7 @@ export default Account
Now that we have all the components in place, let's update `App.js`:
-```jsx title="src/App.js"
+```jsx title=src/App.js
import './index.css'
import { useState, useEffect } from 'react'
import { supabase } from './supabaseClient'
@@ -285,7 +285,7 @@ Every Supabase project is configured with [Storage](/docs/guides/storage) for ma
Let's create an avatar for the user so that they can upload a profile photo. We can start by creating a new component:
-```jsx title="src/Avatar.js"
+```jsx title=src/Avatar.js
import { useEffect, useState } from 'react'
import { supabase } from './supabaseClient'
@@ -372,7 +372,7 @@ export default function Avatar({ url, size, onUpload }) {
And then we can add the widget to the Account page:
-```jsx title="src/Account.js"
+```jsx title=src/Account.js
// Import the new component
import Avatar from './Avatar'
diff --git a/apps/docs/docs/guides/with-redwoodjs.mdx b/apps/docs/docs/guides/with-redwoodjs.mdx
index 7e7ee19c265..6cc1e9599b4 100644
--- a/apps/docs/docs/guides/with-redwoodjs.mdx
+++ b/apps/docs/docs/guides/with-redwoodjs.mdx
@@ -273,7 +273,7 @@ Say, **yes** and it will setup the Supabase client in your app and also provide
Next, we want to save the environment variables in a `.env`.
We need the `API URL` as well as the `anon` and `jwt_secret` keys that you copied [earlier](#get-the-api-keys).
-```bash title=".env"
+```bash title=.env
SUPABASE_URL=YOUR_SUPABASE_URL
SUPABASE_KEY=YOUR_SUPABASE_ANON_KEY
SUPABASE_JWT_SECRET=YOUR_SUPABASE_JWT_SECRET
@@ -281,7 +281,7 @@ SUPABASE_JWT_SECRET=YOUR_SUPABASE_JWT_SECRET
And finally, you will also need to save **just** the `web side` environment variables to the `redwood.toml`.
-```bash title="redwood.toml"
+```bash title=redwood.toml
[web]
title = "Supabase Redwood Quickstart"
port = 8910
@@ -299,7 +299,7 @@ since we have [Row Level Security](/docs/guides/auth#row-level-security) enabled
You'll see these being used to configure your Supabase client in `web/src/App.js`:
-```js title="web/src/App.js"
+```js title=web/src/App.js
// ... Redwood imports
import { AuthProvider } from '@redwoodjs/auth'
import { createClient } from '@supabase/supabase-js'
@@ -365,7 +365,7 @@ You can stop the `dev` server if you want; to see your changes, just be sure to
You should see the `Home` page route in `web/src/Routes.js`:
-```bash title="web/src/Routes.js"
+```bash title=web/src/Routes.js
import { Router, Route } from '@redwoodjs/router'
const Routes = () => {
@@ -396,7 +396,7 @@ yarn rw g component auth
Now, update the `Auth.js` component to contain:
-```jsx title="/web/src/components/Auth/Auth.js"
+```jsx title=/web/src/components/Auth/Auth.js
import { useState } from 'react'
import { useAuth } from '@redwoodjs/auth'
@@ -469,7 +469,7 @@ yarn rw g component account
And then update the file to contain:
-```jsx title="web/src/components/Account/Account.js"
+```jsx title=web/src/components/Account/Account.js
import { useState, useEffect } from 'react'
import { useAuth } from '@redwoodjs/auth'
@@ -605,7 +605,7 @@ of the supabase client to interact with your API.
Now that we have all the components in place, let's update your `HomePage` page to use them:
-```jsx title="web/src/pages/HomePage/HomePage.js"
+```jsx title=web/src/pages/HomePage/HomePage.js
import { useAuth } from '@redwoodjs/auth'
import { MetaTags } from '@redwoodjs/web'
@@ -658,7 +658,7 @@ yarn rw g component avatar
Now, update your Avatar component to contain the following widget:
-```jsx title="web/src/components/Avatar/Avatar.js"
+```jsx title=web/src/components/Avatar/Avatar.js
import { useEffect, useState } from 'react'
import { useAuth } from '@redwoodjs/auth'
@@ -751,7 +751,7 @@ export default Avatar
And then we can add the widget to the Account component:
-```jsx title="web/src/components/Account/Account.js"
+```jsx title=web/src/components/Account/Account.js
// Import the new component
import Avatar from 'src/components/Avatar'
diff --git a/apps/docs/docs/guides/with-solidjs.mdx b/apps/docs/docs/guides/with-solidjs.mdx
index d1c5f6a362c..979eaa0705b 100644
--- a/apps/docs/docs/guides/with-solidjs.mdx
+++ b/apps/docs/docs/guides/with-solidjs.mdx
@@ -42,7 +42,7 @@ npm install @supabase/supabase-js
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the `anon` key that you copied [earlier](#get-the-api-keys).
-```bash title=".env"
+```bash title=.env
VITE_SUPABASE_URL=YOUR_SUPABASE_URL
VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
@@ -50,7 +50,7 @@ VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
Now that we have the API credentials in place, let's create a helper file to initialize the Supabase client. These variables will be exposed
on the browser, and that's completely fine since we have [Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
-```js title="src/supabaseClient.jsx"
+```js title=src/supabaseClient.jsx
import { createClient } from '@supabase/supabase-js'
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL
@@ -66,7 +66,7 @@ You can find the full contents of this file [here](https://raw.githubusercontent
Let's set up a SolidJS component to manage logins and sign ups. We'll use Magic Links, so users can sign in with their email without using passwords.
-```jsx title="/src/Auth.tsx"
+```jsx title=src/Auth.tsx
import { createSignal } from 'solid-js'
import { supabase } from './supabaseClient'
@@ -126,7 +126,7 @@ After a user is signed in we can allow them to edit their profile details and ma
Let's create a new component for that called `Account.tsx`.
-```jsx title="src/Account.tsx"
+```jsx title=src/Account.tsx
import { AuthSession } from '@supabase/supabase-js'
import { Component, createEffect, createSignal } from 'solid-js'
import { supabase } from './supabaseClient'
@@ -245,7 +245,7 @@ export default Account
Now that we have all the components in place, let's update `App.tsx`:
-```jsx title="src/App.tsx"
+```jsx title=src/App.tsx
import { Component, createEffect, createSignal } from 'solid-js'
import { supabase } from './supabaseClient'
import { AuthSession } from '@supabase/supabase-js'
@@ -293,7 +293,7 @@ Every Supabase project is configured with [Storage](/docs/guides/storage) for ma
Let's create an avatar for the user so that they can upload a profile photo. We can start by creating a new component:
-```jsx title="src/Avatar.tsx"
+```jsx title=src/Avatar.tsx
import { Component, createEffect, createSignal, JSX } from 'solid-js'
import { supabase } from './supabaseClient'
@@ -396,7 +396,7 @@ export default Avatar
And then we can add the widget to the Account page:
-```jsx title="src/Account.tsx"
+```jsx title=src/Account.tsx
// Import the new component
import Avatar from './Avatar'
diff --git a/apps/docs/docs/guides/with-svelte.mdx b/apps/docs/docs/guides/with-svelte.mdx
index feacadd1122..221580d6dec 100644
--- a/apps/docs/docs/guides/with-svelte.mdx
+++ b/apps/docs/docs/guides/with-svelte.mdx
@@ -43,7 +43,7 @@ npm install @supabase/supabase-js
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the `anon` key that you copied [earlier](#get-the-api-keys).
-```bash title=".env"
+```bash title=.env
VITE_SUPABASE_URL=YOUR_SUPABASE_URL
VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
@@ -51,7 +51,7 @@ VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
Now that we have the API credentials in place, let's create a helper file to initialize the Supabase client. These variables will be exposed
on the browser, and that's completely fine since we have [Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
-```js title="src/supabaseClient.ts"
+```js title=src/supabaseClient.ts
import { createClient } from '@supabase/supabase-js'
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL
@@ -67,7 +67,7 @@ You can find the full contents of this file [here](https://raw.githubusercontent
Let's set up a Svelte component to manage logins and sign ups. We'll use Magic Links, so users can sign in with their email without using passwords.
-```html title="src/lib/Auth.svelte"
+```html title=src/lib/Auth.svelte
<script lang="ts">
import { supabase } from 'src/supabaseClient'
@@ -120,7 +120,7 @@ Let's set up a Svelte component to manage logins and sign ups. We'll use Magic L
After a user is signed in we can allow them to edit their profile details and manage their account.
Let's create a new component for that called `Account.svelte`.
-```html title="src/lib/Account.svelte"
+```html title=src/lib/Account.svelte
<script lang="ts">
import { onMount } from "svelte";
import type { AuthSession } from "@supabase/supabase-js";
@@ -217,7 +217,7 @@ Let's create a new component for that called `Account.svelte`.
Now that we have all the components in place, let's update `App.svelte`:
-```html title="src/App.svelte"
+```html title=src/App.svelte
<script lang="ts">
import { onMount } from 'svelte'
import { supabase } from './supabaseClient'
@@ -267,7 +267,7 @@ Every Supabase project is configured with [Storage](/docs/guides/storage) for ma
Let's create an avatar for the user so that they can upload a profile photo. We can start by creating a new component:
-```html title="src/lib/Avatar.svelte"
+```html title=src/lib/Avatar.svelte
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import { supabase } from '../supabaseClient'
@@ -357,7 +357,7 @@ Let's create an avatar for the user so that they can upload a profile photo. We
And then we can add the widget to the Account page:
-```html title="src/lib/Account.svelte"
+```html title=src/lib/Account.svelte
<script lang="ts">
// Import the new component
import Avatar from './Avatar.svelte'
diff --git a/apps/docs/docs/guides/with-sveltekit.mdx b/apps/docs/docs/guides/with-sveltekit.mdx
index 3f6964977e3..76a21a54da2 100644
--- a/apps/docs/docs/guides/with-sveltekit.mdx
+++ b/apps/docs/docs/guides/with-sveltekit.mdx
@@ -44,7 +44,7 @@ npm install @supabase/supabase-js
And finally we want to save the environment variables in a `.env`.
All we need are the `SUPABASE_URL` and the `SUPABASE_KEY` key that you copied [earlier](#get-the-api-keys).
-```bash title=".env"
+```bash title=.env
PUBLIC_SUPABASE_URL="YOUR_SUPABASE_URL"
PUBLIC_SUPABASE_ANON_KEY="YOUR_SUPABASE_KEY"
```
@@ -52,7 +52,7 @@ PUBLIC_SUPABASE_ANON_KEY="YOUR_SUPABASE_KEY"
Now that we have the API credentials in place, let's create a helper file to initialize the Supabase client. These variables will be exposed
on the browser, and that's completely fine since we have [Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
-```js title="src/lib/supabaseClient.ts"
+```js title=src/lib/supabaseClient.ts
import { createClient } from '@supabase/auth-helpers-sveltekit'
import { env } from '$env/dynamic/public'
@@ -76,7 +76,7 @@ npm install @supabase/auth-helpers-sveltekit
Update your `src/routes/+layout.svelte`:
-```html title="src/routes/+layout.svelte"
+```html title=src/routes/+layout.svelte
<script lang="ts">
import { supabaseClient } from '$lib/supabaseClient'
import { invalidate } from '$app/navigation'
@@ -103,7 +103,7 @@ Update your `src/routes/+layout.svelte`:
Create a new `src/routes/+layout.ts` file to handle the session on the client-side.
-```ts title="src/routes/+layout.ts"
+```ts title=src/routes/+layout.ts
import type { LayoutLoad } from './$types'
import { getSupabase } from '@supabase/auth-helpers-sveltekit'
@@ -115,7 +115,7 @@ export const load: LayoutLoad = async (event) => {
Create a new `src/routes/+layout.server.ts` file to handle the session on the server-side.
-```ts title="src/routes/+layout.server.ts"
+```ts title=src/routes/+layout.server.ts
import type { LayoutServerLoad } from './$types'
import { getServerSession } from '@supabase/auth-helpers-sveltekit'
@@ -128,11 +128,11 @@ export const load: LayoutServerLoad = async (event) => {
Be sure to create `src/hooks.client.ts` and `src/hooks.server.ts` in order to get the auth helper started on the client and server-side.
-```ts title="src/hooks.client.ts"
+```ts title=src/hooks.client.ts
import '$lib/supabaseClient'
```
-```ts title="src/hooks.server.ts"
+```ts title=src/hooks.server.ts
import '$lib/supabaseClient'
```
@@ -140,7 +140,7 @@ import '$lib/supabaseClient'
Let's set up a Svelte component to manage logins and sign ups. We'll use Magic Links, so users can sign in with their email without using passwords.
-```html title="src/routes/Auth.svelte"
+```html title=src/routes/Auth.svelte
<script lang="ts">
import { supabaseClient } from '$lib/supabaseClient'
@@ -183,7 +183,7 @@ Let's set up a Svelte component to manage logins and sign ups. We'll use Magic L
After a user is signed in, they need to be able to edit their profile details and manage their account.
Create a new `Account.svelte` component to handle this functionality.
-```html title="src/routes/Account.svelte"
+```html title=src/routes/Account.svelte
<script lang="ts">
import { onMount } from 'svelte'
import type { AuthSession } from '@supabase/supabase-js'
@@ -296,7 +296,7 @@ Create a new `Account.svelte` component to handle this functionality.
Now that we have all the components in place, let's update `src/routes/+page.svelte`:
-```html title="src/routes/+page.svelte"
+```html title=src/routes/+page.svelte
<script>
import { page } from '$app/stores'
import Account from './Account.svelte'
@@ -333,7 +333,7 @@ Every Supabase project is configured with [Storage](/docs/guides/storage) for ma
Let's create an avatar for the user so that they can upload a profile photo. We can start by creating a new component:
-```html title="src/routes/Avatar.svelte"
+```html title=src/routes/Avatar.svelte
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import { supabaseClient } from '$lib/supabaseClient'
@@ -423,7 +423,7 @@ Let's create an avatar for the user so that they can upload a profile photo. We
And then we can add the widget to the Account page:
-```html title="src/routes/Account.svelte"
+```html title=src/routes/Account.svelte
<script>
// Import the new component
import Avatar from './Avatar.svelte'
diff --git a/apps/docs/docs/guides/with-vue-3.mdx b/apps/docs/docs/guides/with-vue-3.mdx
index 8f328be5c64..60f566882c7 100644
--- a/apps/docs/docs/guides/with-vue-3.mdx
+++ b/apps/docs/docs/guides/with-vue-3.mdx
@@ -48,7 +48,7 @@ npm install @supabase/supabase-js
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the `anon` key that you copied [earlier](#get-the-api-keys).
-```bash title=".env"
+```bash title=.env
VITE_SUPABASE_URL=YOUR_SUPABASE_URL
VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
@@ -56,7 +56,7 @@ VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
Now that we have the API credentials in place, let's create a helper file to initialize the Supabase client. These variables will be exposed
on the browser, and that's completely fine since we have [Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
-```js title="src/supabase.js"
+```js title=src/supabase.js
import { createClient } from '@supabase/supabase-js'
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL
@@ -71,7 +71,7 @@ Optionally, update [src/style.css](https://raw.githubusercontent.com/supabase/su
Let's set up a Vue component to manage logins and sign ups. We'll use Magic Links, so users can sign in with their email without using passwords.
-```html title="/src/components/Auth.vue"
+```html title=/src/components/Auth.vue
<script setup>
import { ref } from 'vue'
import { supabase } from '../supabase'
@@ -123,7 +123,7 @@ Let's set up a Vue component to manage logins and sign ups. We'll use Magic Link
After a user is signed in we can allow them to edit their profile details and manage their account.
Let's create a new component for that called `Account.vue`.
-```html title="src/components/Account.vue"
+```html title=src/components/Account.vue
<script setup>
import { supabase } from '../supabase'
import { onMounted, ref, toRefs } from 'vue'
@@ -236,7 +236,7 @@ Let's create a new component for that called `Account.vue`.
Now that we have all the components in place, let's update `App.vue`:
-```html title="src/App.vue"
+```html title=src/App.vue
<script setup>
import { onMounted, ref } from 'vue'
import Account from './components/Account.vue'
@@ -282,7 +282,7 @@ Every Supabase project is configured with [Storage](/docs/guides/storage) for ma
Let's create an avatar for the user so that they can upload a profile photo. We can start by creating a new component:
-```html title="src/components/Avatar.vue"
+```html title=src/components/Avatar.vue
<script setup>
import { ref, toRefs, watch } from 'vue'
import { supabase } from '../supabase'
@@ -366,7 +366,7 @@ Let's create an avatar for the user so that they can upload a profile photo. We
And then we can add the widget to the Account page:
-```html title="src/components/Account.vue"
+```html title=src/components/Account.vue
<script>
// Import the new component
import Avatar from './Avatar.vue'
diff --git a/apps/docs/docs/reference/dart/initializing.mdx b/apps/docs/docs/reference/dart/initializing.mdx
index 3a76f300c65..00a69bbf1f3 100644
--- a/apps/docs/docs/reference/dart/initializing.mdx
+++ b/apps/docs/docs/reference/dart/initializing.mdx
@@ -13,7 +13,7 @@ For `supabase-flutter`, you will be using the static `initialize()` method on `S
### Flutter `initialize()`
-```dart title="main.dart"
+```dart title=main.dart
Future<void> main() async {
await Supabase.initialize(url: 'https://xyzcompany.supabase.co', anonKey: 'public-anon-key');
runApp(MyApp());
diff --git a/apps/docs/docs/reference/javascript/upgrade-guide.mdx b/apps/docs/docs/reference/javascript/upgrade-guide.mdx
index 4e15f42d0e0..d02770e854f 100644
--- a/apps/docs/docs/reference/javascript/upgrade-guide.mdx
+++ b/apps/docs/docs/reference/javascript/upgrade-guide.mdx
@@ -27,7 +27,7 @@ _Optionally_ if you are using custom configuration with `createClient` then foll
>
<TabPanel id="1.0x" label="Before">
-```ts title="src/supabaseClient.ts"
+```ts title=src/supabaseClient.ts
const supabaseClient = createClient(SUPABASE_URL, SUPABASE_ANON_KEY, {
schema: 'custom',
persistSession: false,
@@ -37,7 +37,7 @@ const supabaseClient = createClient(SUPABASE_URL, SUPABASE_ANON_KEY, {
</TabPanel>
<TabPanel id="2.0x" label="After">
-```ts title="src/supabaseClient.ts"
+```ts title=src/supabaseClient.ts
const supabaseClient = createClient(SUPABASE_URL, SUPABASE_ANON_KEY, {
db: {
schema: 'custom',