Skip to content

Commit d7ec7c2

Browse files
authored
Fix markup for backtick in code voice (#76)
This markup is the only way to create a code-voice backtick in markdown, even though it creates a warning due to DocC's meaning of double backticks to delimit code voice. See also that known issue: #71 swiftlang/swift-markdown#93 The current (escaped) markup for the 'code' and 'x' example in Lexical structure does render the backticks, but the backticks are in plain font instead of code voice, which isn't correct. Fixes rdar://102988329
2 parents abf95b5 + 50e1adf commit d7ec7c2

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

Sources/TSPL/TSPL.docc/ReferenceManual/LexicalStructure.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,17 @@ are reserved for the Swift compiler and standard library.
122122
To use a reserved word as an identifier,
123123
put a backtick (\`) before and after it.
124124
For example, `class` isn't a valid identifier,
125-
but \``class`\` is valid.
125+
but `` `class` `` is valid.
126126
The backticks aren't considered part of the identifier;
127-
\``x`\` and `x` have the same meaning.
127+
`` `x` `` and `x` have the same meaning.
128+
129+
<!--
130+
The paragraph above produces a link-resolution warning
131+
because of a known issue with ` in code voice.
132+
133+
https://github.com/apple/swift-book/issues/71
134+
https://github.com/apple/swift-markdown/issues/93
135+
-->
128136

129137
Inside a closure with no explicit parameter names,
130138
the parameters are implicitly named `$0`, `$1`, `$2`, and so on.
@@ -143,6 +151,15 @@ of the <doc:Attributes> chapter.
143151
the section name isn't title case so it doesn't necessarily look like a title.
144152
-->
145153

154+
<!--
155+
The formal grammar below for 'identifier'
156+
produces a link-resolution warning
157+
because of a known issue with ` in code voice.
158+
159+
https://github.com/apple/swift-book/issues/71
160+
https://github.com/apple/swift-markdown/issues/93
161+
-->
162+
146163
> Grammar of an identifier:
147164
>
148165
> *identifier**identifier-head* *identifier-characters*_?_
@@ -430,7 +447,7 @@ The following tokens are reserved as punctuation
430447
and can't be used as custom operators:
431448
`(`, `)`, `{`, `}`, `[`, `]`,
432449
`.`, `,`, `:`, `;`, `=`, `@`, `#`,
433-
`&` (as a prefix operator), `->`, `\\``,
450+
`&` (as a prefix operator), `->`, `` ` ``,
434451
`?`, and `!` (as a postfix operator).
435452

436453
## Literals

0 commit comments

Comments
 (0)