Skip to content

Commit a30cdca

Browse files
committed
readme: added jumbo, improved
1 parent 457bfbf commit a30cdca

File tree

1 file changed

+41
-10
lines changed

1 file changed

+41
-10
lines changed

readme.md

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
[NEON](https://ne-on.org): Nette Object Notation
2-
================================================
1+
[![NEON](https://github.com/nette/neon/assets/194960/9d3c809d-0a60-4ff0-a54a-bbb25273a8a8)](https://ne-on.org)
32

43
[![Downloads this Month](https://img.shields.io/packagist/dm/nette/neon.svg)](https://packagist.org/packages/nette/neon)
54
[![Tests](https://github.com/nette/neon/workflows/Tests/badge.svg?branch=master)](https://github.com/nette/neon/actions)
65
[![Coverage Status](https://coveralls.io/repos/github/nette/neon/badge.svg?branch=master)](https://coveralls.io/github/nette/neon?branch=master)
76
[![Latest Stable Version](https://poser.pugx.org/nette/neon/v/stable)](https://github.com/nette/neon/releases)
87
[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/nette/neon/blob/master/license.md)
98

9+
 <!---->
1010

1111
Introduction
1212
============
@@ -17,6 +17,7 @@ NEON stands for *Nette Object Notation*. It is less complex and ungainly than XM
1717

1818
NEON is built from the ground up to be simple to use.
1919

20+
 <!---->
2021

2122
[Support Neon](https://github.com/sponsors/dg)
2223
----------------------------------------------
@@ -27,6 +28,7 @@ Do you like NEON? Are you looking forward to the new features?
2728

2829
Thank you!
2930

31+
 <!---->
3032

3133
Usage
3234
=====
@@ -62,6 +64,7 @@ $value = Neon::decodeFile('config.neon');
6264

6365
All methods throw `Nette\Neon\Exception` on error.
6466

67+
 <!---->
6568

6669
Integration
6770
===========
@@ -84,6 +87,8 @@ You can check for syntax errors in Neon files using the `neon-lint` console comm
8487
vendor/bin/neon-lint <path>
8588
```
8689

90+
 <!---->
91+
8792
Syntax
8893
======
8994

@@ -176,11 +181,11 @@ Values of mappings and sequences may be other mappings and sequences. The level
176181

177182
```neon
178183
pets:
179-
- Cat
180-
- Dog
184+
- Cat
185+
- Dog
181186
cars:
182-
- Volvo
183-
- Skoda
187+
- Volvo
188+
- Skoda
184189
```
185190

186191
In PHP, the same structure would be written as:
@@ -218,6 +223,28 @@ item: [
218223
]
219224
```
220225

226+
In the previous case, we wrote a mapping whose elements were sequences. Now, let's try it the other way around and create a sequence containing mappings:
227+
228+
```neon
229+
-
230+
name: John
231+
age: 35
232+
-
233+
name: Peter
234+
age: 28
235+
```
236+
237+
It's not necessary for the bullet points to be on separate lines; they can also be placed in this manner:
238+
239+
```neon
240+
- name: John
241+
age: 35
242+
- name: Peter
243+
age: 28
244+
```
245+
246+
It's up to you whether you align the keys in a column using spaces or a tab.
247+
221248
Because PHP uses the same structure for mapping and sequences, that is, arrays, both can be merged. The indentation is the same this time:
222249

223250
```neon
@@ -236,6 +263,7 @@ In PHP, the same structure would be written as:
236263
]
237264
```
238265

266+
239267
Strings
240268
-------
241269
Strings in NEON can be enclosed in single or double quotes. But as you can see, they can also be without quotes.
@@ -246,7 +274,7 @@ Strings in NEON can be enclosed in single or double quotes. But as you can see,
246274
- "A double-quoted string in NEON"
247275
```
248276

249-
If the string contains characters that can be confused with NEON syntax (hyphens, colons, etc.), it must be enclosed in quotation marks. We recommend using single quotes because they do not use escaping. If you need to enclose a quotation mark in such a string, double it:
277+
If the string contains characters `# " ' , : = - [ ] { } ( )` that can be confused with NEON syntax, it must be enclosed in quotation marks. We recommend using single quotes because they do not use escaping. If you need to enclose a quotation mark in such a string, double it:
250278

251279
```neon
252280
'A single quote '' inside a single-quoted string'
@@ -265,7 +293,7 @@ There are other cases where you need to enclose strings in quotation marks:
265293
- NEON would understand them as [dates](#dates)
266294

267295

268-
Multiline strings
296+
Multiline Strings
269297
-----------------
270298

271299
A multiline string begins and ends with a triple quotation mark on separate lines. The indent of the first line is ignored for all lines:
@@ -307,6 +335,7 @@ NEON understands numbers written in so-called scientific notation and also numbe
307335
- 0x7A # hexa number
308336
```
309337

338+
310339
Nulls
311340
-----
312341
Null can be expressed in NEON by using `null` or by not specifying a value. Variants with a capital first or all uppercase letters are also allowed.
@@ -316,6 +345,7 @@ a: null
316345
b:
317346
```
318347

348+
319349
Booleans
320350
--------
321351
Boolean values are expressed in NEON using `true` / `false` or `yes` / `no`. Variants with a capital first or all uppercase letters are also allowed.
@@ -324,6 +354,7 @@ Boolean values are expressed in NEON using `true` / `false` or `yes` / `no`. Var
324354
[true, TRUE, True, false, yes, no]
325355
```
326356

357+
327358
Dates
328359
-----
329360
NEON uses the following formats to express data and automatically converts them to `DateTimeImmutable` objects:
@@ -345,7 +376,7 @@ An entity is a structure that resembles a function call:
345376
Column(type: int, nulls: yes)
346377
```
347378

348-
In PHP, it is parsed as an object [Nette\Neon\Entity](https://api.nette.org/3.0/Nette/Neon/Entity.html):
379+
In PHP, it is parsed as an object [Nette\Neon\Entity](https://api.nette.org/3.4/Nette/Neon/Entity.html):
349380

350381
```php
351382
// PHP
@@ -390,7 +421,7 @@ country: USA
390421
```
391422

392423

393-
NEON versus JSON
424+
NEON Versus JSON
394425
================
395426
JSON is a subset of NEON. Each JSON can therefore be parsed as NEON:
396427

0 commit comments

Comments
 (0)