Skip to content

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

chore: add codeblocks

Jonathan Summers-Muir5545e0c6687c
diff --git a/www/_blog/2020-08-05-supabase-auth.mdx b/www/_blog/2020-08-05-supabase-auth.mdx
index d307cb4de50..0a0b8f5abd0 100644
--- a/www/_blog/2020-08-05-supabase-auth.mdx
+++ b/www/_blog/2020-08-05-supabase-auth.mdx
@@ -60,20 +60,21 @@ Authentication only gets you so far. When you need granular authorization rules,
With policies, your database becomes the rules engine. Instead of repetitively filtering your queries, like this ...
-```js
-const loggedInUserId = 'd0714948'
-let user = await supabase.from('users').select('user_id, name').eq('user_id', loggedInUserId)
-
-// Returns { id: 'd0714948', name: 'Jane' }
-```
+<CodeBlock
+ code={`const loggedInUserId = 'd0714948'
+let user = await supabase.from('users').select('user_id, name').eq('user_id', loggedInUserId)\n
+// Returns { id: 'd0714948', name: 'Jane'
+`}
+ lang="js"
+/>
... you can simply define a rule on your database table, `auth.uid() = user_id`, and your request will return the rows which pass the rule, even when you remove the filter from your middleware:
-```js
-let user = await supabase.from('users').select('user_id, name')
-
-// Still returns { id: 'd0714948', name: 'Jane' }
-```
+<CodeBlock
+ code={`let user = await supabase.from('users').select('user_id, name')\n
+// Still returns { id: 'd0714948', name: 'Jane' }`}
+ lang="js"
+/>
### Open source
diff --git a/www/_blog/2020-12-13-supabase-dashboard-performance.mdx b/www/_blog/2020-12-13-supabase-dashboard-performance.mdx
index 6b4fa906f1e..40defdf17d9 100644
--- a/www/_blog/2020-12-13-supabase-dashboard-performance.mdx
+++ b/www/_blog/2020-12-13-supabase-dashboard-performance.mdx
@@ -53,17 +53,17 @@ We reverted our [crypto-js](https://github.com/brix/crypto-js) module from versi
By selectively importing functions from modules like `lodash`, we cut the gzipped size by another 40kb across all our bundles.
-```jsx
-// before
-import _ from 'lodash'
-
+<CodeBlock
+ code={`// before
+import _ from 'lodash'\n
// maunally cherry picking modules
import find from 'lodash/find'
-import debounce from 'lodash/debounce'
-
+import debounce from 'lodash/debounce'\n
// using babel-plugin-lodash
import { find, debounce } from 'lodash'
-```
+`}
+ lang="js"
+/>
In the above example, we added [babel-plugin-lodash](https://github.com/lodash/babel-plugin-lodash) to our babel configuration which cherry picks the exact `lodash` functions we import. This makes it easier to import from `lodash` without cluttering the code with selective import statements.