You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for an initial directive argument without a name (#27)
* Add support for a leading directive argument without a name
* Update the supported years in check-source
* Add missing copyright information to Markdown.md
* Document changes to name-value argument syntax
Copy file name to clipboardExpand all lines: Sources/Markdown/Markdown.docc/Markdown/BlockDirectives.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,12 +73,18 @@ You can parse argument text segments however you like. Swift Markdown also inclu
73
73
74
74
When using the name-value argument parser, this results in arguments `x` with value `1` and `y` with value `2`. Names and values are both strings; it's up to you to decide how to convert them into something more specific.
75
75
76
+
When using the name-value argument parser, the first argument can be unnamed for when the directive name also describes the purpose of the first argument. This parsed name-value pair will have an empty name. All other arguments have both names and values.
77
+
76
78
Here is the grammar of name-value argument syntax:
77
79
78
80
```
79
-
Arguments -> Argument ArgumentsRest?
80
-
ArgumentsRest -> , Arguments
81
+
Arguments -> FirstArgument ArgumentsRest?
82
+
ArgumentsRest -> , NamedArguments
83
+
NamedArguments -> Argument ArgumentsRest?
84
+
FirstArgument -> UnnamedArgument
85
+
| Argument
81
86
Argument -> Literal : Literal
87
+
UnnamedArgument -> Literal
82
88
Literal -> QuotedLiteral
83
89
| UnquotedLiteral
84
90
QuotedLiteral -> " QuotedLiteralContent "
@@ -171,4 +177,4 @@ for diagnostic in collector.diagnostics {
171
177
}
172
178
```
173
179
174
-
<!-- Copyright (c) 2021 Apple Inc and the Swift Project authors. All Rights Reserved. -->
180
+
<!-- Copyright (c) 2021-2022 Apple Inc and the Swift Project authors. All Rights Reserved. -->
0 commit comments