@@ -518,14 +518,108 @@ JSONH uses a `MAJOR.MINOR` versioning system to ensure changes to the syntax are
518518
519519Implementations may support one or more major versions of JSONH.
520520
521- # # Recommendations
521+ # # Style Guide
522522
523- The JSONH format is designed to be flexible, so you are free to ignore any usage recommendations.
523+ The JSONH format is intended to be flexible, so feel free to ignore any recommendations.
524+
525+ This style guide is a suggestion for writing readable JSONH.
526+
527+ # ## General
524528
525- Nevertheless, the following practices are recommended :
526529- Use UTF-8 encoding (see [UTF-8 Everywhere](http://utf8everywhere.org)).
527530- Use UNIX-style line endings (`\n`).
528- - Use four-space indents.
531+ - Use ASCII spaces (` `).
532+ - Use four spaces for indents.
533+
534+ # ## Objects
535+
536+ - Use the same-line opening style.
537+ ` ` ` jsonh
538+ a: {
539+ b: c
540+ }
541+ ` ` `
542+
543+ - Avoid commas between properties on multiple lines.
544+ ` ` ` jsonh
545+ {
546+ a: b
547+ c: d
548+ }
549+ ` ` `
550+
551+ - Avoid braces around the root object.
552+ ` ` ` jsonh
553+ a: b
554+ ` ` `
555+
556+ # ## Arrays
557+
558+ - Use the same-line opening style.
559+ ` ` ` jsonh
560+ a: [
561+ b
562+ ]
563+ ` ` `
564+
565+ - Avoid commas between items on multiple lines.
566+ ` ` ` jsonh
567+ [
568+ a
569+ b
570+ ]
571+ ` ` `
572+
573+ # ## Strings
574+
575+ - Use quoteless strings for identifiers.
576+ ` ` ` jsonh
577+ name: lum_invader
578+ ` ` `
579+
580+ - Use double-quoted strings for single-line strings.
581+ ` ` ` jsonh
582+ name: "Lum Invader"
583+ ` ` `
584+
585+ - Use multi-quoted strings with double-quotes for multi-line strings. Use the same-line opening style and one extra indent.
586+ ` ` ` jsonh
587+ name: """
588+ Lum
589+ Invader
590+ """
591+ ` ` `
592+
593+ # ## Numbers
594+
595+ - Avoid leading/trailing decimal points.
596+ ` ` ` jsonh
597+ 1.0
598+ ` ` `
599+
600+ - Use underscores between groups of 3 digits.
601+ ` ` ` jsonh
602+ 1_000_000
603+ ` ` `
604+
605+ - Use lowercase base specifiers.
606+ ` ` ` jsonh
607+ 0b1
608+ ` ` `
609+
610+ # ## Comments
611+
612+ - Use line-style comments for single-line comments.
613+ ` ` ` jsonh
614+ // Line comment
615+ ` ` `
616+
617+ - Use block-style comments for multi-line comments.
618+ ` ` ` jsonh
619+ /*
620+ Block comment
621+ */
622+ ` ` `
529623
530624# # Version History
531625
0 commit comments