Commit graph

98 commits

Author SHA1 Message Date
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
Vincent Prouillet cb962f7a64 Add aliases to sections 2019-06-02 20:21:06 +02:00
Vincent Prouillet fae644cffe Update pulldown_cmark
Close #693
2019-05-29 20:33:36 +02:00
Vincent Prouillet ec61a57841 Use @/ for internal links rather than ./
Close #686
2019-05-27 14:35:18 +02:00
Marcus Klaas de Vries 0d964204c3 Check command global (#683)
* Add check subcommand

* Add some brief documentation for the check subcommand

* Start working on parallel link checks

* Check all external links in Site

* Return *all* dead links in site
2019-05-27 14:05:07 +02:00
Chris Morgan 1a9ab968fe Allow manual specification of header IDs (#685)
Justification for this feature is added in the docs.

Precedent for the precise syntax: Hugo.

Hugo puts this syntax behind a preference named headerIds, and automatic
header ID generation behind a preference named autoHeaderIds, with both
enabled by default. I have not implemented a switch to disable this.

My suggestion for a workaround for the improbable case of desiring a
literal “{#…}” at the end of a header is to replace `}` with `&#125;`.

The algorithm I have used is not identical to [that
which Hugo uses][0], because Hugo’s looks to work at the source level,
whereas here we work at the pulldown-cmark event level, which is
generally more sane, but potentially limiting for extremely esoteric
IDs.

Practical differences in implementation from Hugo (based purely on
reading [blackfriday’s implementation][0], not actually trying it):

- I believe Hugo would treat `# Foo {#*bar*}` as a heading with text
  “Foo” and ID `*bar*`, since it is working at the source level; whereas
  this code turns it into a heading with HTML `Foo {#<em>bar</em>}`, as
  it works at the pulldown-cmark event level and doesn’t go out of its
  way to make that work (I’m not familiar with pulldown-cmark, but I get
  the impression that you could make it work Hugo’s way on this point).
  The difference should be negligible: only *very* esoteric hashes would
  include magic Markdown characters.

- Hugo will automatically generate an ID for `{#}`, whereas what I’ve
  coded here will yield a blank ID instead (which feels more correct to
  me—`None` versus `Some("")`, and all that).

In practice the results should be identical.

Fixes #433.

[0]: a477dd1646/block.go (L218-L234)
2019-05-20 13:08:49 -07:00
Michael Plotke 2804b40875 strip wrapping whitespace from newline outward from shortcodes 2019-04-10 13:31:33 -04:00
Vincent Prouillet 283a15cd93 Fix some deprecation notice of pest 2019-03-19 21:35:49 +01:00
Vincent Prouillet c63b7fde44 load_data now defaults to plain type + fix bug with get_taxonomy fn 2019-03-16 10:01:11 +01:00
Vincent Prouillet 3eaf13d49b Update pulldown_cmark 2019-03-15 21:29:51 +01:00
Vincent Prouillet 11c58458e8 Revert useless change in shortcodes 2019-02-22 21:02:42 +01:00
Vincent Prouillet 84f10f6b69 Use platform separator for shortcodes paths 2019-02-16 16:32:11 +01:00
Vincent Prouillet 9bc675f2a7 Fix colocated dates + rustfmt
Closes #607
2019-02-09 19:54:47 +01:00
Peng Guanwen 0b897ce7c7 Replace trim_{left, right} with trim_{start, end}
trim_{start, end} is introduced in rust 1.30.0 and
trim_{left, right} is deprecated since 1.33.0.
2019-01-29 16:30:54 +08:00
Vincent Prouillet 9398ab789c Clone-less toc making 2019-01-28 00:34:18 +01:00
Vincent Prouillet 1e2dd9ce03 Update tera to v1 alpha 2019-01-23 19:20:43 +01:00
Vincent Prouillet 464e384760
Merge pull request #581 from peng1999/event-refined
Footnote is now supported in headers
2019-01-22 17:24:33 +01:00
Nicolas Pochet b65979fac7
Render the theme template files if present
* Change the behavior of the template rendering:
    * Check if the template bare name is present
    * Check if the template is part of a theme
    * Fallback to defaults
* Change the behavior of the shortcode rendering:
    * Call the template rendering function
* Prepend `__zola_builtins/` to most of the default elements in `ZOLA_TERA`
* Add a test to verify the presence and content of a `404.html` page
from a theme's template
2019-01-19 18:06:51 +01:00
Peng Guanwen 5ab3466e2b Doc improvements 2019-01-18 22:50:35 +08:00
Vincent Prouillet 5caf24f06c Remove error-chain
Closes #576
2019-01-17 14:31:47 +01:00
Peng Guanwen 1dbd8874c0 derive Debug for HeaderIndex 2019-01-16 17:09:23 +08:00
Peng Guanwen c027cd97d6 Footnote is now supported in headers
This fixes #569 .

`markdown_to_html` is heavily refactored, header-related things is
handled in a second pass.
2019-01-12 16:55:52 +08:00
toidiu 09f691fa47 add id to continue reading p tag (#577)
* add id to continue reading p tag
2019-01-07 19:20:19 +01:00
Peng Guanwen 7130616f63 Minor fixes 2019-01-06 19:04:53 +08:00
Peng Guanwen 972aab1ac4 Add emphasis, strong and code support in header 2019-01-05 23:50:30 +08:00
Peng Guanwen 774514f4d4 refactor markdown_to_html
this commit contains two refactors:
- extract custom link transformations into a function.
- separate some trivial markup generation.
2019-01-05 23:50:30 +08:00
Vincent Prouillet b3004c69ef Fix broken taxonomies pagination
Closes #533
2018-11-29 20:24:46 +01:00
Shotaro Yamada 692103bff4 Remove redundant clone 2018-11-19 23:08:34 +09:00
Vincent Prouillet e2c3bb2ce2 Fix shortcodes <-> markdown indentation 2018-11-16 18:19:38 +01:00