Skip to content

Commit

Permalink
docs(code-input): clarify languageAlternatives, theme (#1953)
Browse files Browse the repository at this point in the history
As it stands, the documentation offers no example of how `languageAlternatives` is structured, which leads many to wrongfully input an array of plain strings. This includes me from the present and the past - I've faced this 3 times already 😆 

I've also linked to the underlying library's site for a reference on themes, as the 4 listed in the current documentation aren't doesn't comprehend all possibilities. Let me know if this makes sense :)
  • Loading branch information
hdoro committed Aug 20, 2021
1 parent 0ac5da7 commit 448aabb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/@sanity/code-input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ Note that the above only works if you import and use the `all:part:@sanity/base/
## Options

- `language` - Default language for this code field
- `languageAlternatives` - Array of languages that should be available
- `theme` - Name of the theme to use. Possible values: `['github', 'monokai', 'terminal', 'tomorrow']`
- `languageAlternatives` - Array of languages that should be available (se its format in the example below)
- `theme` - Name of the theme to use.
- Possible values include: `['github', 'monokai', 'terminal', 'tomorrow']`.
- For the full list and a live playground, refer to the [react-ace page](http://securingsincity.github.io/react-ace/).
- `withFilename` - Boolean option to display input field for filename

```js
Expand All @@ -44,7 +46,14 @@ Note that the above only works if you import and use the `all:part:@sanity/base/
title: 'Example usage',
type: 'code',
options: {
language: 'js'
theme: 'solarized_dark',
language: 'js',
languageAlternatives: [
{title: 'Javascript', value: 'js'},
{title: 'HTML', value: 'html'},
{title: 'CSS', value: 'css'},
{title: 'SASS', value: 'sass'},
]
}
}
```
Expand Down

2 comments on commit 448aabb

@vercel
Copy link

@vercel vercel bot commented on 448aabb Aug 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 448aabb Aug 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

perf-studio – ./

perf-studio.sanity.build
perf-studio-git-next.sanity.build

Please sign in to comment.