diff --git a/README.md b/README.md index fed49023..41c67caa 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,10 @@ Confluence instance and update it accordingly. File in extended format should follow specification ```markdown -[]:# (X-Space: ) -[]:# (X-Parent: ) -[]:# (X-Parent: ) -[]:# (X-Title: ) +<!-- Space: <space key> --> +<!-- Parent: <parent 1> --> +<!-- Parent: <parent 2> --> +<!-- Title: <title> --> <page contents> ``` diff --git a/pkg/mark/meta.go b/pkg/mark/meta.go index b49f9b2f..8c025f20 100644 --- a/pkg/mark/meta.go +++ b/pkg/mark/meta.go @@ -43,7 +43,10 @@ type Meta struct { } func ExtractMeta(data []byte) (*Meta, error) { - headerPattern := regexp.MustCompile(`\[\]:\s*#\s*\(([^:]+):\s*(.*)\)`) + var ( + headerPatternV1 = regexp.MustCompile(`\[\]:\s*#\s*\(([^:]+):\s*(.*)\)`) + headerPatternV2 = regexp.MustCompile(`<!--\s*([^:]+):\s*(.*)\s*-->`) + ) var meta *Meta @@ -55,9 +58,19 @@ func ExtractMeta(data []byte) (*Meta, error) { return nil, err } - matches := headerPattern.FindStringSubmatch(line) + matches := headerPatternV2.FindStringSubmatch(line) if matches == nil { - break + matches = headerPatternV1.FindStringSubmatch(line) + if matches == nil { + break + } + + log.Warningf( + fmt.Errorf(`legacy header usage found: %s`, line), + "please use new header format: <!-- %s: %s -->", + matches[1], + matches[2], + ) } if meta == nil {