Skip to content

Commit 56669f3

Browse files
committed
Clarify language selection examples
1 parent 85a9ea0 commit 56669f3

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,16 @@ showing a different document so the viewer starts at the beginning.
8686

8787
### Languages
8888

89-
Swift is the default. Select another common language with `language`, ask
90-
Highlight.js to detect it automatically, or pass any bundled Highlight.js
91-
language identifier as a string literal:
89+
Swift is the default. Pass an explicit Highlight.js language identifier in
90+
quotes, or use `.automatic` without quotes to ask Highlight.js to detect the
91+
language from the source contents:
9292

9393
```swift
9494
CodeViewer(
9595
documentID: "script",
9696
sourceCode: pythonSource,
9797
highlightStore: highlights,
98-
language: .python
98+
language: "python"
9999
)
100100

101101
CodeViewer(
@@ -113,9 +113,11 @@ CodeViewer(
113113
)
114114
```
115115

116-
Predefined values include Swift, Python, JavaScript, TypeScript, JSON, HTML,
117-
CSS, Bash, C, C++, C#, Objective-C, Java, Kotlin, Go, Rust, Ruby, PHP, SQL,
118-
Markdown, and YAML. The complete set of bundled identifiers is documented by
116+
Bundled language identifiers include `"swift"`, `"python"`, `"javascript"`,
117+
`"typescript"`, `"json"`, `"html"`, `"css"`, `"bash"`, `"c"`, `"cpp"`,
118+
`"csharp"`, `"objectivec"`, `"java"`, `"kotlin"`, `"go"`, `"rust"`,
119+
`"ruby"`, `"php"`, `"sql"`, `"markdown"`, and `"yaml"`. The complete set is
120+
documented by
119121
[HighlightSwift](https://github.com/appstefan/HighlightSwift/blob/v1.1.0/Sources/HighlightSwift/Highlight/HighlightLanguage.swift).
120122

121123
Prefer an explicit language when it is known. Automatic detection performs

0 commit comments

Comments
 (0)