aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 2b35fef11bc4df14413bf02e00481bb092c96891 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
This blog can be built with the `pyblog` script. The `pyblog` script currently provides the following actions:

* `new_post` (aliases: `n`, `new`);
* `touch` (aliases: `t`, `tou`);
* `generate` (aliases: `g`, `gen`);
* `regenerate` (aliases: `r`, `regen`);
* `preview` (aliases: `p`, `pre`).
* `deploy` (aliases: `d`, `dep`);
* `gen_deploy` (aliases: `gd`, `gendep`);
* `edit` (aliases: `e`, `ed`).

Run `pyblog --help` for more information, and `pyblog <action> --help` for what the action does and how to perform the action.

Note that `pyblog` is incompatible with Python 2.x, and in fact only tested on Python 3.4+.

The theme of this blog is largely based on that of [mort.ninja](http://mort.ninja) by [Mort Yao](https://github.com/soimort). See [this post](https://zmwangx.github.io/blog/2015-05-05-new-blog-new-start.html) for more details.

Self-hosted Google Web Fonts are downloaded from [google-webfonts-helper](https://google-webfonts-helper.herokuapp.com/fonts), courtesy of [Mario Ranftl](http://ranf.tl/2014/12/23/self-hosting-google-web-fonts/).

Warning: If the link generation didin't work use the script : `pandoc_version_switch.sh`. Don't forget to adapt the pandoc version !

## Markdown features of `pyblog`

`pyblog` uses Pandoc for Markdown processing. The HTML template is
located at [`master/template.html`](master/template.html).

Beyond Pandoc's standard Markdown to HTML conversion, `pyblog`
postprocesses Pandoc-generated HTML to add a few Markdown extensions and
blogging-friendly HTML transforms.

### Markdown extensions

#### Image size

Allows specifying image size in a Markdown image construct `![]()`. The
syntax is:

    ![|width(xheight)?| alt](src)

where `width` and `height` are positive integers (`xheight` is
optional), and `alt` is the regular `alt` string (either plain or with
some Markdown formatting). The `alt` string, as usual, is optional.

Examples:

    ![|1920x1080| Hello, world!](http://example.com/hello.png)
    ![|1920| *Hey!*](http://example.com/hey.png)
    ![|1280x800|](http://example.com/noalt.png)

See `process_image_sizes` in [`pyblog`](pyblog).

### Other HTML transforms

#### Link images to originals

`img` tags are automatically converted to clickable links to their
originals (with `target="_blank"` so the original is opened in a new
tab).

See `link_img_tags` in [`pyblog`](pyblog).

#### Footnote backlinks

Pandoc Markdown has footnote support, but unfortunately doesn't support
backlinks. This transform inserts a backlink to the end of each
footnote so that readers won't get lost after finish reading a footnote.

## Configuration

The configuration files are placed in the folder config and use the toml
file configuration format.

The `blog.toml` is the configuration file who can be edited safely for
confifguring the blog.

The second file `generator.toml` can be modified if you know what you are doing
and it used to configure the generator.

## About

This tool has been developped by [zmwangx](https://zhimingwang.org) and modified by [neodarz](https://neodarz.net)