Skip to content

Commit ac885c2

Browse files
committed
feat: add TOML support
1 parent ffe38a3 commit ac885c2

4 files changed

Lines changed: 25 additions & 4 deletions

File tree

.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"json",
3333
"latex",
3434
"markdown",
35+
"toml",
3536
"xml",
3637
"yaml",
3738
// Configuration Language

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ npm run sample
5555

5656
To add a new language, first add it to `languages/lang.yml`. In the suitable category, add a new list item in the format of `key value`, where `key` is the language id of [Prism.js](https://prismjs.com/#supported-languages), and the `value` is the display name of the language in the select box. Then, create a new file `{key}.txt` under `languages/samples/` and write your sample code in it. Finally, add this language to `.babelrc` so that it can be correctly loaded.
5757

58-
> [!WARNING]
59-
>
60-
> `npm run dev` will not watch for changes under `languages/` directory. So you have to manually update it.
61-
6258
### Customization
6359

6460
Since I removed sensitive information from the project, you need to run `npm run init` to create placeholder files even if you don't need them. These files are placed under `src/views/components/`.

languages/lang.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Markup Language:
2626
- json JSON
2727
- latex LaTeX
2828
- markdown Markdown
29+
- toml TOML
2930
- xml XML
3031
- yaml YAML
3132
Configuration Language:

languages/samples/toml.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This is a TOML document
2+
3+
title = "TOML Example"
4+
5+
[owner]
6+
name = "Tom Preston-Werner"
7+
dob = 1979-05-27T07:32:00-08:00
8+
9+
[database]
10+
enabled = true
11+
ports = [ 8000, 8001, 8002 ]
12+
data = [ ["delta", "phi"], [3.14] ]
13+
temp_targets = { cpu = 79.5, case = 72.0 }
14+
15+
[servers]
16+
17+
[servers.alpha]
18+
ip = "10.0.0.1"
19+
role = "frontend"
20+
21+
[servers.beta]
22+
ip = "10.0.0.2"
23+
role = "backend"

0 commit comments

Comments
 (0)