Repository navigation
docs: code block example language - #11235
Merged
Merged
Conversation
|
@Hallidayo is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
dannykng
reviewed
Dec 23, 2022
dannykng
left a comment
There was a problem hiding this comment.
Nice one @Hallidayo! Looping in @MildTomato and @saltcod for review.
alaister
requested changes
Dec 28, 2022
alaister
left a comment
Member
There was a problem hiding this comment.
Looks great @Hallidayo! Thank you 🙏🏻
Comment on lines
+134
to
+140
| const codeBlockLang = example?.code?.includes('```js') | ||
| ? 'js' | ||
| : example?.code?.includes('```ts') | ||
| ? 'ts' | ||
| : example?.code?.includes('```dart') | ||
| ? 'dart' | ||
| : 'js' |
Member
There was a problem hiding this comment.
Are we able to use .startsWith() here instead of .includes()? Shouldn't be an issue really but might make it slightly safer 😅
Collaborator
Author
There was a problem hiding this comment.
@alaister just changed this now to use .startsWith()
alaister
approved these changes
Jan 2, 2023
1 of 2 tasks
antlio
pushed a commit
that referenced
this pull request
Nov 20, 2026
## Problem
Three code blocks in the docs guides use the wrong language tag, so they
are highlighted and type-checked as JavaScript or TypeScript instead of
what they are:
- `guides/database/arrays.mdx`: a SQL query is tagged `js`
- `guides/database/import-data.mdx`: the `pgloader config.load` command
is tagged `jsx`
- `guides/ai/hybrid-search.mdx`: a cURL command is tagged `tsx`
The docs style guide says JavaScript and TypeScript blocks get type
hints and are formatted by Prettier, which does not apply to these
blocks.
## Solution
Retag the blocks: `sql` for the query and `bash` for the two shell
commands (`bash` is the most common shell tag in the guides).
For the SQL block I also lowercased the keywords, per the style guide's
"Prefer lowercase for SQL". Prettier's SQL plugin rewrites
`textarray[1]` to `textarray as [1]`, which is not valid Postgres, so
the block is preceded by `{/* prettier-ignore */}`, the same convention
already used in `guides/ai/engineering-for-scale.mdx` and
`guides/api/query-plans.mdx`.
Earlier PRs fixed the same kind of problem: #11870, #19033, #14856,
#11235.
## Review instructions
1. Open the diff: only the language tags change, plus the lowercase SQL
and the `prettier-ignore` comment in `arrays.mdx`.
2. Check the three pages in the preview: the SQL block in the SQL tab of
"Working with arrays", the `pgloader` step in "Import data into
Supabase", and the cURL block in "Hybrid search".
3. Run `pnpm test:prettier`. It passes for these files with the repo's
`prettier.config.mjs`.
## Checklist
- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide).
(Not run: this edit only changes code fence languages, and I applied the
style guide's code block rules by hand.)
Co-authored-by: Santhosh-x23 <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Supabase Docs - Javascript & Dart references
What is the current behavior?
Currently on the docs the code block examples are using
jsso somedartkeywords do not get highlighted:What is the new behavior?
Keywords are now highlighted:
Also
dartat the top of thedartexamples has been removed.Additional context
I've done this for
js,tsanddartas these were the only examples I could see in the spec.Closes #11225
Closes #11226