Skip to content

Commit 8d98fdb

Browse files
committed
More polishing
1 parent 35f92fa commit 8d98fdb

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

README.md

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,23 @@
3030

3131
## Quick Into to YINI Format
3232

33-
A small example using YINI in TypeScript:
34-
```ts
35-
import YINI from 'yini-parser'
36-
37-
const config = YINI.parse(`
33+
YINI code looks like this:
34+
```yini
35+
// This is a comment in YINI
3836
// YINI is a simple, human-readable configuration file format.
3937
40-
// Note: In YINI, spaces and tabs don't change meaning -
41-
// indentation is just for readability.
38+
// Note: In YINI, spaces and tabs don't change meaning - indentation is just
39+
// for readability.
40+
41+
/* This is a block comment
42+
43+
In YINI, section headers use repeated characters "^" at the start to
44+
show their level: (Section header names are case-sensitive.)
45+
46+
^ SectionLevel1
47+
^^ SectionLevel2
48+
^^^ SectionLevel3
49+
*/
4250
4351
^ App // Definition of section (group) "App"
4452
name = 'My Title' // Keys and values are written as key = value
@@ -49,22 +57,10 @@ const config = YINI.parse(`
4957
^^ Special
5058
primaryColor = #336699 // Hex number format
5159
isCaching = false // "OFF" and "NO" works too
52-
`)
53-
54-
// To parse from a file instead:
55-
// const config = YINI.parseFile('./config.yini')
56-
57-
console.log(config.App.name) // My Title
58-
console.log(config.App.Special.isCaching) // false
59-
console.log()
60-
console.log(config)
6160
```
6261

63-
**Output:**
62+
**The above YINI converted to a JS object:**
6463
```js
65-
My Title
66-
false
67-
6864
{
6965
App: {
7066
name: 'My Title',

0 commit comments

Comments
 (0)