Skip to content

Add code formatter for Markdown #480

@MoritzWeber0

Description

@MoritzWeber0

So far, prettier formats our HTML and SCSS files. It doesn't change the Markdown files. The main benefit of auto-formatting Markdown files is the automatic wrapping of lines, making it easier to read.

I tried:

  • prettier without additional plugins and proseWrap: always ➡️ Breaks shortcodes
  • prettier-plugin-hugo-post with proseWrap: always ➡️ Works better, but breaks self-closing shortcodes and sometimes moves shortcode sections in one line.

Requirements:

  • Auto-wrap lines after 80 characters (to be able to view the content on smaller displays)

  • Place each shortcode opening or closing tag in a new line:

    {{% highlight important %}}
    Example
    {{% /highlight %}}

    instead of

    {{% highlight important %}} Example {{% /highlight %}}

We might need to write our own formatter to achieve the goals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    technicalTechnical issues, e.g. related to Hugo, HTML, CSS, deployment, etc.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions