@@ -599,6 +599,60 @@ See also:
599
599
* [[#secure-context]]
600
600
* [[#consent]]
601
601
602
+ <h3 id=text-formats>Design textual formats for humans</h3>
603
+
604
+ Design textual formats that can be easily produced and consumed by people.
605
+ Textual formats also improve [transparency] (https://www.w3.org/TR/ethical-web-principles/#transparent).
606
+
607
+ Favor readability over compactness.
608
+ File size can be optimized by tooling,
609
+ and tends to become a lower priority over time.
610
+ When file size is a significantly higher priority,
611
+ perhaps a textual format is not appropriate.
612
+
613
+ <div class=example>
614
+ SVG path syntax was designed to be compact,
615
+ with single-letter commands and unlabeled series of coordinates after them.
616
+ At the time, file size was a primary concern,
617
+ but while the importance of size efficiency has declined over time,
618
+ the cost to human readability has remained the same.
619
+ </div>
620
+
621
+ People who are presented with a textual format
622
+ should be able to use a text editor
623
+ to easily produce or modify content.
624
+ People who edit text will introduce a range of errors, but
625
+ could struggle to identify and fix those errors.
626
+
627
+ People expect some amount of flexibility in terms of how their edits are processed.
628
+ [[#avoid-ambiguity|Clearly defining]] syntactic flexibility--
629
+ such as in white space, quoting, or delimiters--
630
+ could ensure that content is both easy to edit and produces consistent results.
631
+
632
+ <div class=example>
633
+ The JSON format is an example of a format that appears to be flexible,
634
+ but it lacks many of these basic usability amenities.
635
+ In JSON there is:
636
+ no commenting capability,
637
+ objects and arrays cannot have trailing commas, and
638
+ quotes are mandatory for object keys.
639
+ This makes JSON prone to syntactic errors as a result of manual edits.
640
+ </div>
641
+
642
+ Containing the scope of a format that is affected by a syntax error
643
+ could improve robustness and human usability.
644
+ This requires that specifications fully define processing and
645
+ error handling so that all inputs result in consistent outcomes.
646
+
647
+ <div class=example>
648
+ Typos in CSS properties only cause that property to be ignored.
649
+ Errors in properties rarely cause an entire rule to be lost.
650
+ </div>
651
+
652
+ If your format is intended to be used only by machines,
653
+ a binary format is likely to be more efficient,
654
+ in addition to discouraging people from authoring or editing content directly.
655
+
602
656
<h3 id="secure-context">Consider limiting new features to secure contexts</h3>
603
657
604
658
Always limit your feature to secure contexts
0 commit comments