conedevelopment / cone-site

The new 11ty-based portfolio website of Cone.
https://conedevelopment.com
3 stars 2 forks source link

Should Markdown Front Matter be indented with 4 spaces? #4

Closed szepeviktor closed 11 months ago

szepeviktor commented 11 months ago

Currently it uses mixed 2 and 4 space indents. https://github.com/conedevelopment/cone-site/blob/f8433015e516b119e0ba6f926e3d01c16ae1ea51/src/works.md?plain=1#L19-L28

https://github.com/conedevelopment/cone-site/blob/f8433015e516b119e0ba6f926e3d01c16ae1ea51/.editorconfig#L8

It would be nice to see 4 space indentations everywhere, even in Sass files!

adamlaki commented 11 months ago

As I see this should be 4 but my IDE switches to 2 when there is a "-". I think because to keep the line on the oter elements.

It seems to me that this is a feature.

image

szepeviktor commented 11 months ago

There is a solution in the YAML Spec / "Example 2.4 Sequence of Mappings". It will feel strange!! 😨

It goes like PSR-12 in PHP

    public function i_want_to_be_separated_from_function_body()
    { 👈🏻 this almost empty line does the separation
        $this->do_it();
    }

Now let's see in YAML!

important_values:
- 👈🏻 this almost empty line does the separation
    title: Symphonie Nr. 40 G minor
    composer: Madi Mozart
-
    title: next item
    composer: is also a PHP tool

See it in action: separation but no blank lines.

szepeviktor commented 11 months ago

May I send a PR with the above format + CI workflow to keep it that way?

adamlaki commented 11 months ago

Is there a way to also solve it in my editor? Right now we have 4 spaces in .md files but still it doesn't care when I use -.

szepeviktor commented 11 months ago

For example https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one

I send a PR now then you decide!

adamlaki commented 11 months ago

Okay, thank you!