This makes Splash correctly highlight key paths that are passed as arguments
to a function, especially when there’s no external parameter label for that
argument.
This patch makes Splash correctly highlight nested closures marked with
the `@escaping` attribute. The fix is to start treating `@` like a proper
token, rather than as a delimiter.
This change adds a new command line tool to the Splash family:
`SplashMarkdown`.
It’s an adapted version of the tool that I’ve been using for months to
publish every article on Swift by Sundell, and works by replacing all
code blocks within a Markdown file.
Adding this will hopefully make Splash even easier to use, without the
need for writing custom tooling, or to manually replace each code block
within a Markdown file with a “splashed” version.
Swift 5 enables us to define custom ways to interpolate expressions into
strings, and Splash already successfully highlights that syntax, but let’s
add a test to make sure that continues to be the case.
This change makes Splash capable of highlighting Swift 5 raw strings,
although it’s currently limited to single line string literals. Support
for multi-line literals will be added in a future commit.
This change adds SwiftLint to the project. For now, the rules are tweaked
to match the current state of the code base — but will over time be changed
back to their defaults in several cases.
Some smaller changes (mostly related to code style) were applied to the
project to remove all warnings.
This change enables Splash to highlight multi-line comments that begin
with two asterisks, rather than just one. A test has also been added to
verify that documentation-style multi-line comments with an asterisk on
each line are also highlighted correctly.
This change makes Splash merge tokens of the same type (along with any
whitespace in between them) when generating HTML. The result is much
smaller HTML, since less tags have to be used to produce the same result.
This was most obvious with comment highlighting, for example, this comment:
```
// Hello I’m a comment
```
Would generate 5 different <span class="comment"></span> elements. Now
it’s just one!
This change adds support for three pre-processors that can appear in
function delcarations: `#file`, `#line` and `#function`. They’re not
highlighted as pre-processors, but rather as keywords, to match the
way Xcode treats them.
Normally, we don’t want Splash to contain too many special cases for
individual symbol names — but the `XCTAssert` family of functions are
so common that it warrants it. The problem is that Splash would currently
highlight those functions as types, since they are capitalized, which
has now been changed to function calls instead.
This patch makes Splash correctly highlight associated types within
protocol declarations. Like other declarations, typed declared using
the `associatedtype` keyword should not be highlighted.
Previously, the last protocol would be treated as a function call (Splash
thought it was a call with trailing closure syntax, rather than the opening
of a type definition). This patch fixes that by verifying that the code
checking for constraints inside a generic type definition is in fact looking
at a generic, rather than something else.
Swift enables the use of keywords as function names, and we want those
to be treated as plain text (like other function names) rather than as
keywords. Some keywords require escaping using back-ticks, and this
patch accounts for both of those variations.
This change makes it possible to implement custom token types, which is
really useful when building specialized grammars that use non-standard
token types.
This patch makes `HTMLOutputFormat` correctly escape all < and > characters
that occur in source code. Otherwise, a web browser rendering the resulting
HTML will interpret those characters as tags.
This patch fixes syntax highlighting for the following scenario:
```
Type<GenericType>.call()
```
Highlighting generic types is especially tricky, since we want them to
be highlighted when appearing at the call site, like above - but we don’t
want to highlight them when they are being declared. Hopefully with this
fix all/most edge cases are covered.