Syntax highlighting (#691)

* Syntax highlighting mostly... Exists.

* Add dependency to dockerfile

* Handle non-existent languages better

* Make the default a bit nicer

* Improve highlighting. Clean up function

* Add dark theme, add the comment scope to the allowed classes

* update build env

* Address review comments

* Use find_syntax_by_token which produces the desired behavior

* Change flat_map into flatten
(commit cargo.lock)
This commit is contained in:
Violet White
2019-12-30 08:35:27 -05:00
committed by Ana Gelez
parent 597778fd2f
commit 458baf5f78
11 changed files with 392 additions and 21 deletions
@@ -17,3 +17,12 @@ $text-color: $white;
$primary: $purple;
$primary-text-color: $white; // text color on primary background (buttons for instance)
$success-color: $blue;
//Code Highlighting
$code-keyword-color: #f79ac1;
$code-source-color: #a6f0ab;
$code-constant-color: #dfec84;
$code-operator-color: #eddf95;
$code-string-color: #f2ae60;
$code-comment-color: #a3b4f9;
+25
View File
@@ -623,3 +623,28 @@ figure {
}
}
}
//highlighting
code {
.constant{
color: $code-constant-color;
}
.string{
color: $code-string-color;
}
.keyword.type,.keyword.control,.type{
color: $code-keyword-color;
}
.keyword.operator{
color: $code-operator-color;
}
.source{
color: $code-source-color;
}
.comment{
color: $code-comment-color;
}
.function{
color:inherit;
}
}
+8
View File
@@ -27,3 +27,11 @@ $margin: 0 $horizontal-margin;
$route159: "Route159", serif;
$playfair: "Playfair Display", serif;
$lora: "Lora", serif;
//Code Highlighting
$code-keyword-color: #45244a;
$code-source-color: #4c588c;
$code-constant-color: scale-color(magenta,$lightness:-5%);
$code-operator-color: scale-color($code-source-color,$lightness:-5%);
$code-string-color: #8a571c;
$code-comment-color: #1c4c8a;