Giter Club home page Giter Club logo

getzola / zola Goto Github PK

View Code? Open in Web Editor NEW
12.7K 12.7K 891.0 69.06 MB

A fast static site generator in a single binary with everything built-in. https://www.getzola.org

Home Page: https://www.getzola.org

License: MIT License

Rust 97.46% CSS 0.01% HTML 1.79% Python 0.67% JavaScript 0.01% Dockerfile 0.05% SCSS 0.02%
blog-engine cms content-management-system documentation-tool markdown markdown-to-html rust site-generator static static-site-generator tera

zola's People

Contributors

apiraino avatar bdjnk avatar bemyak avatar caemor avatar chris-morgan avatar codesections avatar erichdongubler avatar freaky avatar homeworkprod avatar jamesmunns avatar keats avatar libbum avatar liushuyu avatar mre avatar mscherer avatar mwcz avatar onelson avatar paulcmal avatar peng1999 avatar philipdaniels avatar reillysiemens avatar rootkea avatar samford avatar savente93 avatar sgued avatar southerntofu avatar thomasetter avatar uggla avatar vojtechkral avatar williamyaoh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zola's Issues

Enable pulldown-cmark's table and footnote support

Markdown tables and footnotes are pretty useful, so it would be great if I could use them with gutenberg.

The pulldown-cmark crate already provides optional support for markdown tables and footnotes. It can be easily enabled by passing OPTION_ENABLE_TABLES | OPTION_ENABLE_FOOTNOTES to Parser::new_ext.

Live reload doesn't seem to reload sometimes

While editing a page.
The webserver doesn't seem to send the livereload command on every change for some reason.
Gut feeling is that I tried to make the partial hot reload too smart and I missed some case.

Probably need to add some verbosity level in the app to allow debugging this kind of stuff

How to use `page.next`/`page.previous` fields?

I still can't get the next/previous fields to work. All of the following lead to zero output:

{{ page.next }}
{{ page.next_in_section }}
{{ page.prev }}
{{ page.prev_in_section }}

The pages all have a date field in their front matter, e.g. date = "2015-08-25". Is there something I'm doing wrong?

Template filters `first`/`last` counterintuitive

The last filter of the tera template engine returns the last element of an array. This leads to counterintuitive results when used on an array of pages, since pages|last returns the last page in the pages array, which is actually the first/earliest page (i.e. the page with the lowest ordering). So if one follows the next pointers of a page, one reaches pages|first instead of the expected pages|last.

Retrieve page from file name in template files

I want to order my posts manually, so the default Page::previous/next fields don't work for me (they order by date). Instead, I want to specify the next/previous relations explicitly.

Currently, I try to use the front matter for this, e.g. extra = {prev = "a.md", next = "c.md"}. In the template, I then want to automatically create prev/next links with the page titles:

{% if page.extra.prev %}
    {% prev = get_page(page.extra.prev) %}
    <a class="prev" href="{{ prev.path }}">&laquo; {{ prev.title }}</a>
{% endif %}
{% if page.extra.next %}
     {% next = get_page(page.extra.next) %}
    <a class="next" href="{{ next.path }}">{{ next.title }} &raquo;</a>
{% endif %}

So I need some working replacement for my {% prev = get_page(page.extra.prev) %} strawman syntax. Is this possible somehow or is there an alternative way to achieve manual page ordering?

Shortcodes don't work

When I try to call a shortcode, the following error occurs:

Failed to build the site
Error: Error parsing templates
Reason: 
* Failed to parse '"/home/โ€ฆ/templates/index.html"'
-- Invalid Tera syntax at line 32, column 8

Line 32 of index.html looks like this:

{{ gist(url="https://gist.github.com/Keats/32d26f699dcc13ebd41b") }}

Make a SyntaxSet pool

See trishume/syntect#20 for the syntect issue

Either do a pool in gutenberg or in Syntect as mentioned in the issue above. Doing it in syntect would be nicer as any syntect users will get it instead of duplicating the work in every syntect users but I'm not against having it only in gutenberg.
This currently prevents the markdown rendering from being made parallel but I'm not entirely sure what's the best way to make it work.

Opening this issue in case someone wants to work on that, that would be super helpful!
The code for SyntaxSet should be in rendering/highlighting.rs

Allow sorting by weight/order

Sections and some content don't have dates but we will want to order them somehow. Having weight in the front-matter might do the trick (lighter -> top, heavier -> bottom).

Sections should be able to define how they want to be sorted though. In the _index.md frontmatter, we can add a sort_by key that takes either "date" or "weight".
An alternative is to add a sort_by filter that can handle that from the template itself.

Probably going to wait for some feedback before starting this.

Add shortcodes

Or an equivalent. It could hook into the markdown renderer and render a template when encountering one

List of things to do before 0.0.5

that I found out while working on a site for Tera:

  • Index page is not rendered if there is no _index.md
  • Don't count index section in the line shown in the console, it's a bit misleading as it can not exist physically
  • Let a section have a body (could solve syntax highlighting on index page at the same time)
  • Get syntax highlighting on index page somehow, maybe not needed as it can be done with a js lib but would be nice
  • Be able to render a single section when content changed: can check whether it's the body or front matter and can render only the page itself if only the body changed
  • Add jinja2 syntax
  • Fix the annoying live reload that keeps breaking (#10)

Tracked in #65

Use enum variants for FrontMatter

One PageFrontMatter and one SectionFrontMatter.
Not sure it is worth it though: not being able to refer a specific variant means lots of matching each time though

Pagination

Pagination

A few cases to consider:

  • simple blog, with/without pagination
  • site: typically no pagination
  • site + blog: pagination on some bits only potentially (the blog)
  • random site with pagination on some sections (like a knowledge base for example)

Default is no pagination at all.

Then people can add paginations for whatever section they want. We need 3 elements for each pagination: (section_name, num_per_page, path_name).

Example of mixed site+blog content folder:

content
 - about.md
 - pricing.md
 - blog
   - article1.md
  • section_name: for example you can use blog and it will generate pagination for all the pages in blog. The only way I can see it working for the basic blog is to have a magic name, like base that will work on the first level in the content folder
  • num_per_page: how many pages on each page of the pagination
  • path_name: what goes in the url for the pagination. For example, if I use "page", the second page will be mysite.com/page/2

We can potentially have several type of contents needing pagination, but since I'm not using pagination at all myself, one basic level should be fine to start with.

EDIT: outdated, see below

Page ordering is not section-local

I'm using the sort_by = order setting to order the posts of two sections manually. The problem is that the previous/next fields of a page point to pages of other sections too. For example, if two pages in different sections both have ordering 1, they are currently treated as immediate successors.

Rendering bug for headings that contain `!`

One of my headings is ## Hello World!! in markdown. The generated html is:

<h2 id="hello-world"><a class="anchor" href="#hello-world" aria-label="Anchor link for: hello-world">
    ๐Ÿ”—
</a>
Hello Worldid=""><a class="anchor" href="#" aria-label="Anchor link for: ">
    ๐Ÿ”—
</a>
!id="-1"><a class="anchor" href="#-1" aria-label="Anchor link for: -1">
    ๐Ÿ”—
</a>
!</h2>

Allow loading additional syntaxes for code highlighting

The syntect crate ships a default set of syntaxes that allows to highlight most common languages, but it does not include syntax files for more exotic languages such as nasm. It is possible to load additional syntaxes for such languages through the SyntaxSet::load_syntaxes method. It would be great if gutenberg could support this somehow, for example by adding support for all needed languages in gutenberg itself or by adding a command line argument.

get_section global function & sort sections

Hi!
I'm creating a documentation site for my Rust project. I'm stuck at implementing an index side bar with all section&page titles. My content looks like this:

โ”œโ”€โ”€ doc
โ”‚ย ย  โ”œโ”€โ”€ _index.md
โ”‚ย ย  โ”œโ”€โ”€ intro.md
โ”‚ย ย  โ”œโ”€โ”€ configuration
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ advanced.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ basic.md
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ _index.md
โ”‚ย ย  โ””โ”€โ”€ setup
โ”‚ย ย      โ””โ”€โ”€ _index.md
โ””โ”€โ”€ _index.md

With a global get_section function I could iterate through all subsections of doc and their pages. As an alternative solution, a page could return the section it belongs to. Then I could start with the intro.md page.

On the current section/page I also want to display links to the previous and next section/page. See https://rocket.rs/guide/ as an example. This should be possible with a get_section function, but maybe an additional helper would make sense for that.

Thanks for your work - it looks very promising to me!

Add a get_url global fn

Takes the Site::permalinks and can build urls like in the markdown content from a path such as posts/something.md

The function need to be re-added to Tera everytime a page is updated on the serve command though so it doesn't stop working for newly added files

TODO for 0.0.1

  • serve command with basic live reload
  • Ordering of posts by date
  • Word count + estimated read time
  • Sitemap generation
  • Add summary via <!-- more --> to do the equivalent of https://github.com/getpelican/pelican-plugins/tree/master/summary
  • Generate tags and categories page (allow disabling that since sites don't need that)
  • RSS feed generation
  • Syntax highlighting
  • Split it into lib and crate
  • Only livereload the file for css/js/imgs
  • Copy asset files from content directory
  • Find a way to test site parsing and building
  • Generate section pages (see #465 on hugo for a nice example of nested section use)
  • Add tags & categories pages to the sitemap

Differentiating sites and blogs (maybe?)

That's the main two use cases and things like date or rss feed don't really make sense on a site.
Could be an option in config.toml site_kind: site | blog that automatically pre-configures gutenberg. The init command would ask which kind and generate the appropriate config.toml file

Smarter rebuild on content change

I'm currently leaving TODOs all over the place so the rebuild_after_content_change will take as little time as possible.
Do it once the new way of handling index is in

Built-in Sass support

That's the only reason I still need npm/yarn to build a theme

Unresolved questions:

  • no postcss support?

Broken links in titles

Issue

When adding the following markdown code:

# [](#configure-solarized-with)Configure Solarized with ...

## [](#xresources)Xresources

> **Xresources** is a user-level configuration dotfile, used to set X resources
> used by X client applications.
....

I get the following code:

2017-05-01_15-02-50

Expected behavior

There should be an empty link created before the title, not visible on the page.

Not all `Page` fields serialized

The Page struct contains lots of useful fields such as summary or previous/next that are not available in templates because they're not serialized. Is there a reason for this or is this just an oversight?

Also, it would probably make sense to change the type of the summary field to Option<String> instead of defaulting to an empty summary.

Make description optional?

I'm not quite sure what the description field in the front matter is needed for, so I use description = "" everywhere. Maybe we can make that field optional (and default to "")?

Make it fast

Focus on features first but then work to make it fast

  • Add benchmarks (with test site and generated site with hundreds of pages)
  • Parallelize whenever possible
  • Only rebuild templates that changed
  • Only rebuild pages that changed
  • Only copy static files that changed
  • Cache sublime syntax files
  • Remove clone() as much as possible
  • Don't write files, have some kind of virtual filesystem instead in serve
  • Use lazy_static! for rss/sitemap templates
  • Cache stuff on the filesystem maybe? Hugo does cache some pygments related things in /tmp/hugo_cache

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.