grego / blades

Blazing fast dead simple static site generator
https://www.getblades.org
GNU General Public License v3.0
333 stars 14 forks source link

use markdown as source post format #8

Closed ttys3 closed 3 years ago

ttys3 commented 3 years ago

I'am sorry if the description is not OK.

use toml to write blog seems a bit more "anti-human", if change to markdown, it will be very wonderful

grego commented 3 years ago

You can already use markdown for posts, as for example here. Thanks to TOML multiline strings, it's practically the same as writing a markdown file with a header, which you do with other generators.

There is no standard syntax to add a TOML header to a markdown file (as opposed to YAML, which Jekyll and Hugo use). Having pages in a widely supported standard format makes it easy to interopearate with plugins written in any language, which might get more supported in the future, and also easier for the users to get proper documentation and be certain what they write is correct.

ttys3 commented 3 years ago

it's not about TOML multiline strings.

using TOML to write a blog, is not friendly even to a programer

Jekyll / Hugo and even zola they all support YAML front matter

there's no standard format , but using toml is more difficult.

for example, I can migrate my Hugo based blog to zola with almost nearly no change.

even Github can preview the front matter prepended markdown without any problem.

but Github can not understand and render your toml based markdown

grego commented 3 years ago

That's not true. When you use TOML header in Hugo, GitHub doesn't understand it at all - see here Using TOML is trivial, it's just key - value pairs. I migrated many pages to/from Zola/Hugo in a matter of minutes, it's really easy.

The supported markdown is CommonMark, which is the most standard format I am aware of, not any custom markdown syntax.

ttys3 commented 3 years ago

yes, Github doesn't understand TOML header, but do understand YAML header.

grego commented 3 years ago

That would mean adding support for YAML. TOML was chosen for its simplicity (much easier to parse), as well as its being de facto standard config format in the Rust world, used in other generators like Zola. Thus adding support for YAML kind of goes against Blades' goals of minimality and simplicity. I can keep the issue open and consider it if there is more interest.

ttys3 commented 3 years ago

using TOML in Rust world as config file format has nothing to do with using YAML as markdown front-matter. this is two thing.

in fact, not only in Rust, I use TOML in many languages. but that's not a perfect reason for me to write blog in TOML

use TOML to write blog is friendly to Rust, not to human. but your tool is made for human

ttys3 commented 3 years ago

front-matter has no ISO standards or rfc. but, it just works good.

https://www.getzola.org/documentation/content/page/#path-from-frontmatter

https://gohugo.io/content-management/front-matter/

https://hexo.io/docs/front-matter.html

and the Zola author also prefer to TOML, they even don't like to write the YAML font-matter support in the document. but the code was added and the feature does exists.

they closed related issues again and again:

https://github.com/getzola/zola/issues/189

https://github.com/getzola/zola/issues/317

https://github.com/getzola/zola/issues/498

but finally they added the code. see https://github.com/getzola/zola/commit/4754cb5792a8864f5d808b71b9c43aee51343536

grego commented 3 years ago

On the other hand, adding support for other formats should be quite straightforward, since all the structs already implement Deserialize. The only issue I see is that the datetime format is different, but that could be handled. It could be decided, based on the file extension, whether the given file is markdown with a front matter, YAML or TOML. Feel free to open a PR :)

grego commented 3 years ago

In 6cf90f09f98469d7cd95928a99b3bc370b804862, Blades was made to support .md files with a TOML header delimited by +++. Furthermore, it is format agnostic now, so adding support for additional formats should be trivial now, if there is enough interest.

theowenyoung commented 2 years ago

If yaml is supported, it will be a great help to migrate my previous blog.