WP Manifestindependent plugin directory
manifest / content / markdown-sync

WPORG Markdown Importer

Syncing plugin used for WordPress.org CLI/REST API handbooks

★ 25stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/wp-api/markdown-sync/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Imports Markdown from a remote site (like GitHub) into WordPress as pages.

Configuration

Each importer needs to override the abstract methods:

  • get_base() - Base URL for imported pages. This will be stripped from the key before comparing.
  • get_manifest_url() - URL pointing to the manifest.
  • get_post_type() - Post type to import as.

Manifest Format

The manifest should be a JSON object, with the keys set to the desired permalink (excluding the base path). Each item should also be a JSON object, containing the following keys:

  • slug - Post name to insert. (Must match the final path-part of the key.)
  • markdown_source - URL for the Markdown file to parse into content.
  • parent - Key for the parent to store under. (Must correspond to the non-final path-parts of the key.)
  • title - Title to use when creating post. Used temporarily, will be updated from the Markdown file. If not specified, defaults to slug (but will be updated from Markdown source).

Note: The Handbook index should have the slug index.

Example:

{
    "foo": {
        "title": "Temporary Foo Title",
        "slug": "foo",
        "markdown_source": "https://raw.githubusercontent.com/WordPress/doc-repo/master/foo.md",
        "parent": null
    },
    "foo/bar": {
        "title": "Temporary Bar Title",
        "slug": "bar",
        "markdown_source": "https://raw.githubusercontent.com/WordPress/doc-repo/master/foo/bar.md",
        "parent": "foo"
    },
    "foo/bar/quux": {
        "title": "Temporary Quux Title",
        "slug": "quux",
        "markdown_source": "https://raw.githubusercontent.com/WordPress/doc-repo/master/foo/bar/quux.md",
        "parent": "foo/bar"
    }
}