Commit graph

126 commits

Author SHA1 Message Date
Vincent Prouillet f7a4ef2617 Add draft to section variable in templates
Closes #1592
2021-08-20 19:47:41 +02:00
Sam Vente 56dcfecce2
make clippy a bit happier (#1588) 2021-08-18 09:36:51 +02:00
Vincent Prouillet 8b43667a94 Ensure code block contents are always escaped
Closes #1581
2021-08-18 09:05:00 +02:00
Vincent Prouillet 88e5c6e167 Update deps 2021-08-12 08:54:55 +02:00
Vincent Prouillet 4a87689cfb Add class based syntax higlighting + line numbers (#1531)
* Add class based syntax higlighting + line numbers

* Use fork of syntect for now

* Fix tests

* Fix diff background on inline highlighter

Co-authored-by: evan-brass <evan-brass@protonmail.com>
2021-07-10 08:53:19 +02:00
Vincent Prouillet 2289b2f55a Fix config loading
Closes #1512
2021-06-02 21:46:20 +02:00
François b244bcdfbb
Hide lines in code block (#1453)
* hide lines

* test hide ines

* add documentation

* fix test

* factor shared code with hl_lines
2021-05-14 20:25:13 +02:00
Vincent Prouillet 80843cdeff u16 for anchor levels
Closes #1436
2021-04-26 09:24:27 +02:00
Luca Bruno 3346439a32
rendering: keep track of all internal links (#1424)
This updates rendered markdown structures in order to keep track
of all internal links, not anymore limiting to only those targeting
an explicit anchor fragment.
The goal of this rework is to allow building other features, such
as backlinks, on top of the existing collection of internal links.
2021-04-21 21:13:11 +02:00
Vincent Prouillet 187bc30f00 Serializing lang aware configs 2021-04-07 22:13:15 +02:00
Vincent Prouillet 0812b603a6 Remove deprecated config options 2021-04-07 22:13:15 +02:00
Vincent Prouillet 024144ba78 cargo fmt 2021-02-02 20:49:57 +01:00
southerntofu 14366dafc6
Fix fallback to syntax highlighting theme (closes #1309) (#1312)
* Highlight fallback from extra syntaxes to the theme (close #1309)

* Warning when codeblock language is unknown and cannot be highlighted

* page/section path in codeblock language missing warning

Co-authored-by: southerntofu <southerntofu@thunix.net>
2021-01-18 09:35:17 +01:00
Vincent Prouillet aa03a7fec5 Fix highlighting
Closes #1291
2021-01-07 11:34:48 +01:00
Vincent Prouillet b9b4ef9f04 Add data-lang on code blocks 2021-01-02 09:29:28 +01:00
Vincent Prouillet 39870d8675 Move extra_syntax to markup.rs 2020-12-21 08:54:43 +01:00
Nathanael Lane a210abc5a3 Add shortcode 'invocation' variable to allow a shortcode to track how… (#1236)
* add shortcode 'invocation' variable to allow a shortcode to track how many times it has been invoked in a given Markdown file

* use closure (implicit struct) instead of explicit struct for invocation tracking

* update variable name to "nth"
2020-12-14 20:43:32 +01:00
Vincent Prouillet f20c52b872 Re-use markdown parser for markdown filter 2020-12-14 20:43:31 +01:00
Vincent Prouillet 59d3d8a3da Enable smart punctuation
Closes #740
2020-12-14 20:43:31 +01:00
Vincent Prouillet e58c2d6b6c More details on fs errors 2020-12-14 20:43:31 +01:00
Vincent Prouillet 2c681f3439 Add some external link markdown tweaking options
Closes #681, #695
2020-12-14 20:43:31 +01:00
Vincent Prouillet 047ce32efd Clippy 2020-12-14 20:43:31 +01:00
Vincent Prouillet 94634fe87d Move markdown config to its own section in config.toml 2020-12-14 20:43:31 +01:00
Vladislav Nikonov b1091bbb45 Implemented emoji aliases support in markdown files (#1194)
* Implemented emoji aliases support in markdown files

* Added emoji aliases rendering unit tests

* Added bench for emoji
2020-12-14 20:43:31 +01:00
Christoph Grabo 6ef81940b8 Add language class to code tag
class attribute is only added if a language is available.
It uses the format "language-xxx" as per commonmark spec:
https://spec.commonmark.org/0.29/#example-112 ff.
2020-12-14 20:42:55 +01:00
Vincent Prouillet 59d9d26f0e Fix shortcodes issues with newlines
Closes #1172
2020-09-24 20:02:43 +02:00
Vincent Prouillet b313c97ceb Fix slugified taxonomies rendering
Closes #1177
2020-09-22 09:46:22 +02:00
Alice Ryhl 826e701b4f Add line highlighting to code blocks (#1131)
* Add line highlighting to code blocks

* Fix highlighting of lines

Apparently every line to be highlighted is provided in one chunk.

* Add more documentation to codeblock.rs

* Turn FenceIter into an Iterator

* Move Range to fence.rs

* Add tests
2020-09-22 09:46:22 +02:00
Nathan West 51a2213fcf
Replaced all impl Default with derive(Default), where possible (#1141) 2020-08-19 12:25:54 +02:00
Vincent Prouillet 278cc82fc7
Change zola serve to load HTML from memory instead of disk (#1114)
* Change zola serve to load HTML from memory instead of disk

* Be smart about assets copying

* Be a tiny bit smarter on template changes

* Add zola serve --fast
2020-08-16 18:39:04 +02:00
eaon 28523ac9ad
Allow emitting newlines and whitespace in shortcodes and introduce markdown shortcodes (#1085)
* Replace hack for newline support in shortcodes with new hack

* Be a bit more space efficient/accurate with naming

* Boil newline/whitespace shortcode test down to the essentials

* Make sure the new \n and \s chars in old tests are properly represented

* Support markdown templates and shortcodes

* Refactoring .md/.html shortcode behaviour

* Add test for markdown shortcodes

* Add an html output test for markdown based shortcodes

* Add documentation for Markdown based shortcodes
2020-07-29 20:20:43 +02:00
Vincent Prouillet 2e9b7ba522 Enable task lists 2020-06-11 18:29:05 +02:00
hui.liu 32ca1a14ed
Wrap highlight code blocks with <code> (#1026)
* Wrap highlight code blocks with <code>

* Fix tests for highlight code block
2020-05-18 09:41:56 +02:00
southerntofu e3dc8bbab5
Access heading level in anchor-link.html (#1008)
* Add lvl variable in anchor-link context

* Add docs about lvl in anchor-link.html

* Rename lvl => level
2020-04-29 19:40:25 +02:00
Vincent Prouillet 15a3ab1a51 One last deps update 2020-02-16 19:17:41 +01:00
Aphek cc67bf0c88
Change continue-reading to use a span with id instead of a named anchor in a paragraph (#941)
* Change continue-reading to use a span element instead of named anchor

* Fix all tests
2020-02-07 21:07:10 +01:00
Vincent Prouillet ac3ced828b
Multiple slugification strategies (#929) 2020-02-05 09:13:14 +01:00
Sepehr Torab Parhiz 2fa442cead Add Markdown strikethrough rendering (#924)
Fixes #921
2020-02-02 17:48:43 -08:00
Rostislav 145671ed20 Detect empty links on markdown rendering and issue an error (#884)
* Detect empty links on markdown rendering and issue an error

* Add a test for empty links stopping rendering with an error

* Assert error message is the expected one

When testing for empty links detection compare the error message
to make sure it's the correct error that stopped the process
and not some unrelated issue.
2020-02-02 17:48:43 -08:00
Vincent Prouillet 622b0f2965 Serialize toc level 2020-02-02 17:48:43 -08:00
Sam Ford b63c563622 Format code using cargo fmt (#896) 2020-02-02 17:48:43 -08:00
Sam Ford e804f907b2 Use Rust 2018 edition (#885) 2020-02-02 17:48:43 -08:00
Vincent Prouillet ceb9bc8ed7 Optionally do not slugify paths (#875)
* maybe_slugify() only does simple sanitation if config.slugify is false

* slugify is disabled by default, turn on for backwards-compatibility

* First docs changes for optional slugification

* Remove # from slugs but not &

* Add/fix tests for utf8 slugs

* Fix test sites for i18n slugs

* fix templates tests for i18n slugs

* Rename slugify setting to slugify_paths

* Default slugify_paths

* Update documentation for slugify_paths

* quasi_slugify removes ?, /, # and newlines

* Remove forbidden NTFS chars in quasi_slugify()

* Slugification forbidden chars can be configured

* Remove trailing dot/space in quasi_slugify

* Fix NTFS path sanitation

* Revert configurable slugification charset

* Remove \r for windows newlines and \t tabulations in quasi_slugify()

* Update docs for output paths

* Replace slugify with slugify_paths

* Fix test

* Default to not slugifying

* Move slugs utils to utils crate

* Use slugify_paths for anchors as well
2020-02-02 17:48:43 -08:00
Tjeu Kayim 6149fd17e1 Skip anchor checking for URL with prefix in config (#812)
* cargo fmt & clippy

* Skip anchor checking for URL with prefix in config
2020-02-02 17:45:16 -08:00
Michael Macias b1ceb3e80e rendering: Avoid prepending URL prefix to links that start with a scheme (#817)
Links that start with a scheme (e.g., `tel:18008675309`) inadvertently
had a URL prefix prepended. Previously, only `mailto:` was handled, but
given the sheer number of [registered URI schemes][uri-schemes], a loose
pattern matcher is used to detect schemes instead.

External links, as identified by the renderer, are now limited to `http`
and `https` schemes.

Fixes #747 and fixes #816.

[uri-schemes]: https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
2020-02-02 17:44:38 -08:00
Marcus Klaas de Vries 4fd5d3f348 Bump pulldown_cmark to version 0.6.0 (#797)
* Bump pulldown_cmark to version 0.6.0

* Rename headers to headings
2019-09-06 23:36:30 +02:00
Vincent Prouillet b396a1bc20 Add --drafts flag + rustfmt 2019-08-24 22:23:08 +02:00
southerntofu 4695b029a0 Fix ToC generation for heading levels > 3 (bugfix) (#774)
* Fix ToC generation for heading levels > 3

* typo

* Add tests for deep ToCs

* Code style change
2019-08-15 10:19:32 +02:00
Vincent Prouillet f5c7b44027 Add warning for old style internal link + fix one 2019-07-12 22:56:07 +02:00
Vincent Prouillet 0aee33f9c5 Add very copy/pasty impl of anchor checking 2019-06-06 19:49:40 +02:00