Skip to content

Enhanced plugin docs: Implement markdown parsing and CLI#2433

Merged
sunker merged 15 commits intomainfrom
docs-parser/generate-html
Feb 4, 2026
Merged

Enhanced plugin docs: Implement markdown parsing and CLI#2433
sunker merged 15 commits intomainfrom
docs-parser/generate-html

Conversation

@sunker
Copy link
Contributor

@sunker sunker commented Feb 4, 2026

What this PR does / why we need it:

This PR implements the core markdown parsing functionality for the plugin-docs-renderer package. It adds the ability to load documentation folders inc. manifest.json files, parse markdown content with YAML frontmatter and convert to HTML using GH flavored markdown. The package includes a CLI tool that processes a docs folder and dumps parsed JSON to stdout.

To test this:
This PR in the polystat panel has markdown docs + a manifest file with nested docs tree that can be used for testing.

npx @grafana/plugin-docs-renderer ./docs

Which issue(s) this PR fixes:

Fixes https://github.com/grafana/grafana-community-team/issues/737

Special notes for your reviewer:

The next couple of PRs will add template rendering, validation and a local dev server. Will add more unit tests then.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Hello! 👋 This repository uses Auto for releasing packages using PR labels.

✨ This PR can be merged. It will not be considered when calculating future versions of the npm packages and will not appear in the changelogs.

@sunker sunker added the no-changelog Don't include in changelog and version calculations label Feb 4, 2026
@grafana-plugins-platform-bot grafana-plugins-platform-bot bot moved this from 📬 Triage to 🔬 In review in Plugins Platform / Grafana Community Feb 4, 2026
@sunker sunker self-assigned this Feb 4, 2026
@sunker sunker marked this pull request as ready for review February 4, 2026 07:44
@sunker sunker requested review from a team as code owners February 4, 2026 07:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements core markdown parsing functionality for the @grafana/plugin-docs-renderer package. It introduces the ability to load documentation folders with manifest.json files, parse markdown content with YAML frontmatter, convert to HTML using GitHub Flavored Markdown, and provides a CLI tool for processing documentation folders.

Changes:

  • Added markdown parser with frontmatter extraction using marked and gray-matter libraries
  • Implemented documentation folder loader that recursively finds and reads markdown files
  • Created CLI tool that processes docs folders and outputs parsed JSON to stdout
  • Added comprehensive unit tests for the parser functionality

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/plugin-docs-renderer/src/parser.ts Implements markdown parsing with frontmatter extraction and GFM support
packages/plugin-docs-renderer/src/parser.test.ts Comprehensive test coverage for parser functionality
packages/plugin-docs-renderer/src/loader.ts Recursively loads markdown files and manifest from docs folder
packages/plugin-docs-renderer/src/index.ts Updated exports to include new parser and loader functions
packages/plugin-docs-renderer/src/bin/run.ts CLI tool that processes docs folders and outputs parsed JSON
packages/plugin-docs-renderer/package.json Added dependencies (marked, gray-matter, minimist) and bin configuration
package-lock.json Lock file updates for new dependencies

@sunker sunker requested a review from academo February 4, 2026 10:33
Copy link
Contributor

@academo academo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a nit for you to double check the type assertion on marked.parse but looking good!

@sunker sunker merged commit fb66793 into main Feb 4, 2026
27 checks passed
@github-project-automation github-project-automation bot moved this from 🔬 In review to 🚀 Shipped in Plugins Platform / Grafana Community Feb 4, 2026
@sunker sunker deleted the docs-parser/generate-html branch February 4, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Don't include in changelog and version calculations

Projects

Status: 🚀 Shipped

Development

Successfully merging this pull request may close these issues.

2 participants