Skip to content

Commit

Permalink
Fix markup for backtick in code voice (#76)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
amartini51 authored Dec 12, 2022
2 parents abf95b5 + 50e1adf commit d7ec7c2
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions Sources/TSPL/TSPL.docc/ReferenceManual/LexicalStructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,17 @@ are reserved for the Swift compiler and standard library.
To use a reserved word as an identifier,
put a backtick (\`) before and after it.
For example, `class` isn't a valid identifier,
but \``class`\` is valid.
but `` `class` `` is valid.
The backticks aren't considered part of the identifier;
\``x`\` and `x` have the same meaning.
`` `x` `` and `x` have the same meaning.

<!--
The paragraph above produces a link-resolution warning
because of a known issue with ` in code voice.
https://github.com/apple/swift-book/issues/71
https://github.com/apple/swift-markdown/issues/93
-->

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

<!--
The formal grammar below for 'identifier'
produces a link-resolution warning
because of a known issue with ` in code voice.
https://github.com/apple/swift-book/issues/71
https://github.com/apple/swift-markdown/issues/93
-->

> Grammar of an identifier:
>
> *identifier**identifier-head* *identifier-characters*_?_
Expand Down Expand Up @@ -430,7 +447,7 @@ The following tokens are reserved as punctuation
and can't be used as custom operators:
`(`, `)`, `{`, `}`, `[`, `]`,
`.`, `,`, `:`, `;`, `=`, `@`, `#`,
`&` (as a prefix operator), `->`, `\\``,
`&` (as a prefix operator), `->`, `` ` ``,
`?`, and `!` (as a postfix operator).

## Literals
Expand Down

0 comments on commit d7ec7c2

Please sign in to comment.