Skip to content

Commit 6901610

Browse files
committed
Mention the importance of semantic names in docs
1 parent 0be209b commit 6901610

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

docs/src/examples.md

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ styled"{(underline=warning):this is some minor/slight warning text}"
6969
styled"A very major {(fg=error,bg=warning),bold:warning!}"
7070
```
7171

72+
!!! tip "Focus on semantics, and let style follow"
73+
Note that when using faces, it is generally recommended to focus on the
74+
*semantic intent*, not the specific styling (`cyan`, `bold`, etc.),
75+
introducing new faces when there is no pre-existing semantically appropriate
76+
face.
77+
7278
## Inline face attributes
7379

7480
Should you want to use a particular color just once, the `foreground`/`fg` and `background`/`bg` inline face attributes can be set to hex codes.

docs/src/index.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,14 @@ easily [customized](@ref stdlib-styledstrings-face-toml).
7575
by the package name, i.e. follow the format `mypackage_myface`.
7676
This is important for predictability, and to prevent name clashes.
7777

78-
There is one set of exemptions to the package-prefix rule, the set of basic
79-
faces that are part of the default value of the faces dictionary.
78+
Furthermore, packages should take care to use (and introduce) *semantic*
79+
faces (like `code`) over direct colours and styles (like `cyan`). This is helpful
80+
in a number of ways, from making the intent in usage more obvious, aiding
81+
composability, and making user customisation more intuitive.
82+
83+
There are two set of exemptions to the package-prefix rule:
84+
- the set of basic faces that are part of the default value of the faces dictionary
85+
- faces introduced by Julia's own standard library, namely `JuliaSyntaxHighlighting`
8086

8187
#### [Basic faces](@id stdlib-styledstrings-basic-faces)
8288

0 commit comments

Comments
 (0)