Skip to content

Make addheader respect different YAML/Markdown sections #382

@mxmehl

Description

@mxmehl

Follow-up from #230.

YAML or Markdown files may split their files in sections, separated by ---. We should investigate how addheader may mess with these files and whether adding comments before a first-line --- will break them.

We also have special Markdown files that support YAML (or also TOML) in their first section (Hugo refers to that as "front matter"), but pure Markdown (with HTML comments) in the following section:

---
title: My Title
author: Me

# This is a comment in yaml/toml/whatever inside of a Markdown file
---

# Chapter 1

Hello, world.

<!-- This is a comment inside of Markdown -->

Any ideas how we can cover the different cases without making everything too complex and overly specific?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions