|
1 |
| -.. Copyright (c) 2019--2020 EditorConfig Team |
| 1 | +.. Copyright (c) 2019--2024 EditorConfig Team |
2 | 2 | All rights reserved.
|
3 | 3 |
|
4 | 4 | Redistribution and use in source and binary forms, with or without
|
@@ -73,20 +73,31 @@ EditorConfig organization.
|
73 | 73 | File Format
|
74 | 74 | ===========
|
75 | 75 |
|
| 76 | +.. versionchanged:: 0.16.1 |
| 77 | + |
76 | 78 | EditorConfig files are in an INI-like file format.
|
77 |
| -In an EditorConfig file, all beginning whitespace on each line is considered |
78 |
| -irrelevant. Each line must be one of the following: |
| 79 | +To read an EditorConfig file, take one line at a time. For each line: |
| 80 | + |
| 81 | +#. Strip all leading and trailing whitespace |
| 82 | +#. If the remaining text is empty, ignore the line. |
| 83 | +#. If the remaining text is not empty, process the text as specified for its |
| 84 | + type below. |
| 85 | + |
| 86 | +The types of lines are: |
| 87 | + |
| 88 | +- Comment: starts with a ``;`` or a ``#``. Comment lines are ignored. |
79 | 89 |
|
80 |
| -- Blank: contains only whitespace characters. |
81 |
| -- Comment: starts with a ``;`` or a ``#``. |
82 | 90 | - Section Header: starts with a ``[`` and ends with a ``]``.
|
83 |
| - - May not use any non-whitespace characters outside of the surrounding |
84 |
| - brackets. |
| 91 | + These lines define globs; see :ref:`glob-expressions`. |
| 92 | + |
85 | 93 | - May contain any characters between the square brackets (e.g.,
|
86 | 94 | ``[`` and ``]`` and even spaces and tabs are allowed).
|
87 | 95 | - Forward slashes (``/``) are used as path separators.
|
88 | 96 | - Backslashes (``\\``) are not allowed as path separators (even on Windows).
|
| 97 | + |
89 | 98 | - Key-Value Pair (or Pair): contains a key and a value, separated by an ``=``.
|
| 99 | + See :ref:`supported-pairs`. |
| 100 | + |
90 | 101 | - Key: The part before the first ``=`` (trimmed of whitespace, but including
|
91 | 102 | any whitespace in the middle).
|
92 | 103 | - Value: The part after the first ``=`` (trimmed of whitespace, but including
|
@@ -131,6 +142,8 @@ The parts of an EditorConfig file are:
|
131 | 142 | - Section: the lines starting from a Section Header until the beginning of
|
132 | 143 | the next Section Header or the end of the file.
|
133 | 144 |
|
| 145 | +.. _glob-expressions: |
| 146 | + |
134 | 147 | Glob Expressions
|
135 | 148 | ================
|
136 | 149 |
|
@@ -183,6 +196,8 @@ precedence. If multiple EditorConfig files have matching sections, the rules
|
183 | 196 | from the closer EditorConfig file are read last, so pairs in closer
|
184 | 197 | files take precedence.
|
185 | 198 |
|
| 199 | +.. _supported-pairs: |
| 200 | + |
186 | 201 | Supported Pairs
|
187 | 202 | ===============
|
188 | 203 |
|
|
0 commit comments