GoogleCloudPlatform / GoogleCloudPlatform/open-knowledge-format

Support YAML metadata in a leading HTML comment for GitHub Wiki compatibility

Open
#27 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
467
Forks
35
Avg merge
9m
Merged PRs (30d)
1

Description

Following the [request to separate this proposal from #9](https://github.com/GoogleCloudPlatform/open-knowledge-format/issues/9#issuecomment-5650324697), could OKF support a clearly identified leading HTML comment as an optional alternative to YAML frontmatter?

## Why this matters

GitHub Wiki maintainers could keep one set of Markdown files for human-readable documentation and OKF consumers, without adding visible metadata to page headings or navigation or maintaining a separate export. Conventional frontmatter would remain available wherever visible metadata is desirable.

## GitHub Wiki rendering

Conventional `---` frontmatter renders as a horizontal rule and a large H2 containing the YAML in both the published page and custom sidebar (`_Sidebar.md`).

Wrapping the same metadata in `` hides it from the rendered page and sidebar. The original headings, anchors, and nested navigation remain intact; the metadata remains in the saved Markdown.

Screenshot: conventional YAML adds visible metadata

[View the published YAML example](https://github.com/Ayanmullick/test/wiki/OKF-YAML-Frontmatter).

Published GitHub Wiki page and custom sidebar showing conventional YAML metadata as extra headings

Screenshot: HTML comments preserve clean rendering

[View the published HTML-comment example](https://github.com/Ayanmullick/test/wiki/OKF-HTML-Comment).

Published GitHub Wiki page and custom sidebar with HTML-comment metadata hidden and nested navigation preserved

Reproduction steps and Markdown examples

Save the following as a GitHub Wiki Markdown page and view the published page:

```markdown
---
type: Guide
title: Project Wiki
description: Guides and API documentation.
tags: [documentation, api]
---

# Project Wiki

- [API Guide](#api-guide)
- [API Reference](#api-reference)

## API Guide

Read the guide and explore the reference below.

### API Reference

Use the documented commands and examples.
```

Replace only its leading metadata block with:

```markdown

```

The same comparison applies to `_Sidebar.md`: prepend each metadata form to a list with an indented child link. The screenshots show both the page and narrow custom sidebar.

Example pages: [conventional YAML](https://github.com/Ayanmullick/test/wiki/OKF-YAML-Frontmatter) and [HTML comment](https://github.com/Ayanmullick/test/wiki/OKF-HTML-Comment).

GitHub documentation and rendering references

- [Wiki rendering](https://docs.github.com/en/communities/documenting-your-project-with-wikis/adding-or-editing-wiki-pages#about-wiki-filenames): Markdown Wiki files use GitHub's Markdown converter.
- [Hiding content with HTML comments](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#hiding-content-with-comments): commented content is omitted from rendered Markdown.
- [YAML metadata in documents](https://github.blog/news-insights/product-news/viewing-yaml-metadata-in-your-documents/): describes metadata tables for prose documents generally. The Wiki behavior above differs from that presentation.

## Suggested scope

- Keep conventional frontmatter; allow an explicit, document-start comment marker as an alternative, rather than interpreting arbitrary comments.
- Retain the same metadata fields and validation, including non-empty `type`.
- Define handling for duplicate/conflicting blocks, malformed comments, and YAML values containing HTML-comment delimiters.
- Require consumers to read raw Markdown; hiding metadata is presentation control, not confidentiality.

Would you consider extending the [OKF specification](https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/main/SPEC.md) to support this optional HTML-comment syntax, so GitHub Wikis can be OKF-compliant without displaying metadata to readers?

Contributor guide

Open the contributing guide

Research direction

Start by reading SPEC.md and comparing its conventional frontmatter rules with the issue's HTML-comment examples and GitHub Wiki references. Done means the specification clearly defines the optional document-start syntax, preserves existing metadata validation, and resolves duplicate, malformed, and delimiter-conflict handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, markdown, yaml
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.