17 Commits

Author SHA1 Message Date
Marco Capano
26d4bbe7ca
Add option to specify a grammar for MarkdownDecorator (#101) 2020-04-16 19:28:37 +02:00
John Sundell
3de0275b52
HTML: Fully escape all required entities (#89)
Both when outputting HTML, and when highlighting code blocks within a
Markdown text, Splash now fully escapes all required character entities.
2019-11-23 23:59:16 +00:00
John Sundell
d1dd1acda0
MarkdownDecorator: Enable CSS class prefix to be injected (#83)
This change makes it possible to inject a custom CSS class
prefix into `MarkdownDecorator`, which will in turn be
passed to its underlying HTML-based syntax highlighter.
2019-09-05 11:54:56 +02:00
John Sundell
e107609b00
MarkdownDecorator: Don’t hard code line breaks (#77)
This patch makes MarkdownDecorator not include line breaks before and
after the `<pre>` and `<code>` tags that it adds to code blocks, since
this will be rendered as whitespace in the browser.
2019-07-25 16:10:55 +02:00
John Sundell
8e7599150f
Add SplashMarkdown (#57)
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.
2019-03-15 20:24:53 +01:00
John Sundell
8bc46cbeb0
Add SwiftLint (#49)
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.
2019-03-11 14:52:46 +01:00
John Sundell
6dff287cd2 HTMLOutputFormat: Merge same-type tokens along with whitespace
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!
2019-03-10 21:17:08 +01:00
John Sundell
4c6f71c0de Support custom token types
This change makes it possible to implement custom token types, which is
really useful when building specialized grammars that use non-standard
token types.
2018-09-28 14:02:42 +02:00
John Sundell
c73767a0bc HTMLOutputFormat: Escape < and > characters
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.
2018-08-27 00:14:48 +02:00
John Sundell
a68e461eb4 Replace custom Color struct with typealiases
Now that the decision not to support colors on Linux
has been made, we can replace the custom `Color` struct
with simple typealiases for `NSColor` and `UIColor`.

The same can’t be done for font, since we want to enable
loading of a font from a path, for SPM packages.
2018-08-26 22:49:39 +02:00
John Sundell
1e532a6c4c Theme: Streamline cross-platform implementation
Now that we’re making Splash support iOS as well as
Mac + Linux, we need to create some nice abstractions
to make sure that we can share as much code as possible
between all platforms.

- Define Font.Loaded and Color.Renderable as platform-
specific typealiases for system fonts and colors.
- Don’t compile in non-Linux compatible code when building
for Linux.
- Make Font and Color handle all conversion themselves, so
that AttributedStringOutputFormat can be kept more clean.
2018-08-26 00:54:44 +02:00
Mihael Cholakov
dfd146dadb Removed whitespace 2018-08-25 23:37:24 +03:00
Mihael Cholakov
3952b91e3f Removed whitespace 2018-08-25 23:36:19 +03:00
Mihael Cholakov
305d09e8ac Whitespace removal 2018-08-25 22:11:20 +03:00
Mihael Cholakov
def9e10f1a Shortened loadFont 2018-08-25 22:06:05 +03:00
Mihael Cholakov
5702cea843 Implements iOS support for AttributedStringOutputFormat 2018-08-25 21:49:30 +03:00
John Sundell
8645db8de0 Initial commit 2018-08-24 18:42:07 +02:00