diff --git a/TODO.org b/TODO.org new file mode 100644 index 0000000..46cb300 --- /dev/null +++ b/TODO.org @@ -0,0 +1,17 @@ +* Things to do [3/14] +** DONE If the paragraph only contains an image, text-align center +** DONE Syntax highlighting for code blocks +** TODO Render gnuplot +** TODO Pretty-print the timestamps +** TODO Support Table of Contents +** TODO Support line numbers in code blocks +** TODO Support references to code block lines +** TODO Only include text up to first heading on homepage and include a "read more" link +** DONE Make loading language-specific CSS files conditional on the presence of src blocks using those languages +** TODO Set up tracing so I can use warning and such +** TODO Make copying of language-specific CSS files conditional on the presence of src blocks using those languages +** TODO Switch to an entirely lazily-evaluated output tree +** TODO Add highlighting for languages [0/2] +*** TODO bash +*** TODO gnuplot +** TODO Bug: carry over highlight starts when breaking lines diff --git a/default_environment/stylesheet/language_python.css b/default_environment/stylesheet/language_python.css index e620691..266d5e1 100644 --- a/default_environment/stylesheet/language_python.css +++ b/default_environment/stylesheet/language_python.css @@ -1,38 +1,50 @@ +/* ea912c */ +/* e95a62 */ :root { - --srclg-python-srchl-keyword-color: #1a936f; --srclg-python-srchl-comment-color: #048a81; - --srclg-python-srchl-property-color: #bfbccb; + --srclg-python-srchl-function-builtin-color: #e95a62; + --srclg-python-srchl-keyword-color: #1a936f; + --srclg-python-srchl-property-color: inherit; --srclg-python-srchl-string-color: #ecc30b; - --srclg-python-srchl-string-special-path-color: #067bc2; + --srclg-python-srchl-type-color: #067bc2; + --srclg-python-srchl-variable-color: #ea912c; } @media (prefers-color-scheme: light) { :root { - --srclg-python-srchl-keyword-color: #e56c90; --srclg-python-srchl-comment-color: #fb757e; - --srclg-python-srchl-property-color: #404334; + --srclg-python-srchl-function-builtin-color: #16a59d; + --srclg-python-srchl-keyword-color: #e56c90; + --srclg-python-srchl-property-color: inherit; --srclg-python-srchl-string-color: #133cf4; - --srclg-python-srchl-string-special-path-color: #f9843d; + --srclg-python-srchl-type-color: #f9843d; + --srclg-python-srchl-variable-color: #156ed3; } } .main_content { .src_block { &.srclg_python { - .srchl_keyword { - color: var(--srclg-python-srchl-keyword-color); - } .srchl_comment { color: var(--srclg-python-srchl-comment-color); } + .srchl_function_builtin { + color: var(--srclg-python-srchl-function-builtin-color); + } + .srchl_keyword { + color: var(--srclg-python-srchl-keyword-color); + } .srchl_property { color: var(--srclg-python-srchl-property-color); } .srchl_string { color: var(--srclg-python-srchl-string-color); } - .srchl_string_special_path { - color: var(--srclg-python-srchl-string-special-path-color); + .srchl_type { + color: var(--srclg-python-srchl-type-color); + } + .srchl_variable { + color: var(--srclg-python-srchl-variable-color); } } } diff --git a/default_environment/stylesheet/main.css b/default_environment/stylesheet/main.css index 5c5ef00..46aae3f 100644 --- a/default_environment/stylesheet/main.css +++ b/default_environment/stylesheet/main.css @@ -161,6 +161,7 @@ body { font-size: 1rem; font-family: var(--src-font-family); margin: 1rem 0; + font-variant-ligatures: none; .src_language { display: inline-block; diff --git a/src/intermediate/src_block.rs b/src/intermediate/src_block.rs index 6238dc5..7b357ab 100644 --- a/src/intermediate/src_block.rs +++ b/src/intermediate/src_block.rs @@ -226,7 +226,15 @@ fn highlight_python(lines: &[L]) -> Result, CustomError> where L: Borrow, { - let highlight_names = ["comment"]; + let highlight_names = [ + "comment", + "function.builtin", + "keyword", + "property", + "string", + "type", + "variable", + ]; let language = tree_sitter_python::LANGUAGE.into(); let mut config = HighlightConfiguration::new( language,