plugin-icon

Markdown Renderer for GitHub

作者 wakalab·
Render GitHub Flavored Markdown in WordPress: Shiki syntax highlighting, Mermaid diagrams, and Chart.js charts. Ideal for docs and dev blogs.
版本
2.9.1
活躍安裝總數
10
最近更新:
Jun 10, 2026
Markdown Renderer for GitHub

Markdown Renderer for GitHub brings GitHub-quality content rendering to WordPress. Paste GitHub Flavored Markdown (GFM) – code blocks, tables, task lists, and diagrams – and it renders just like it does on GitHub.com, with no manual HTML and no copy-paste screenshots. Built for technical bloggers, documentation teams, educators, and anyone publishing code-heavy content.

Key Features:

🎨 Beautiful Syntax Highlighting * Powered by Shiki – the same syntax highlighter used by VS Code * Native grammars for 30+ programming languages, with alias and approximate-grammar fallbacks for many more * Two carefully tuned themes – GitHub Light and GitHub Dark – with automatic light/dark switching * Automatic language detection

📊 Mermaid Diagram Support * 9 diagram types: flowcharts, sequence, class, state, Gantt, user journey, Git graph, ER, and pie charts * Professional diagram rendering * Interactive zoom functionality * Error handling with user-friendly messages

📈 Chart.js Chart Support * Create line, bar, pie, doughnut, and more chart types * 8 chart types including scatter, bubble, radar, and Polar Area * Simple JSON configuration in “`chart fenced code blocks * Responsive and interactive charts

🌱 PlantUML Diagram Support (optional, opt-in) * UML and more from “`plantuml fenced code blocks * PlantUML has no in-browser renderer, so diagrams are produced by an external PlantUML/Kroki server * Ships ready to configure, but no content is sent off-site until you set a server URL and accept the privacy notice in the settings (see the Third Party Services section)

GitHub Flavored Markdown * Tables, task lists, strikethrough * Automatic URL linking * Footnotes support * 100% compatible with GitHub markdown

📋 Copy Button Feature * One-click code copying * GitHub-style user experience * Full accessibility support * Mobile-friendly design

Performance Optimized * Asset lazy loading – libraries load only on pages that use them * Minimal performance impact * Self-contained – no external CDN required * Optimized for WordPress

🌍 Developer Friendly * Clean, semantic HTML output * Extensive hooks and filters * Translation ready (i18n) * WordPress coding standards

Perfect for: * Technical blogs and tutorials * Documentation websites * Code portfolios * Educational content * API documentation * Developer resources

Technical Requirements

  • WordPress 6.8 or higher
  • PHP 8.2 or higher
  • Modern browser with JavaScript enabled
  • Recommended: 128MB+ PHP memory limit
  • Recommended: gzip or Brotli compression enabled for static JavaScript on your web server

Why server compression matters: The syntax-highlighting and diagram libraries are large when uncompressed (Shiki ~2.35 MB, Mermaid ~3.2 MB) but shrink dramatically when delivered with gzip or Brotli (Shiki ~302 KB, Mermaid ~908 KB). For the best front-end performance, ensure your web server compresses static JavaScript (for example mod_deflate/mod_brotli on Apache, or the gzip/brotli directives on nginx). Most managed hosts and CDNs enable this by default. The plugin adds a Tools → Site Health check that reports whether these bundles are actually being served compressed.

Support

For support, please visit the WordPress.org support forum for this plugin. Our team actively monitors and responds to support requests.

Before posting a support request: * Check the FAQ section above for common questions * Ensure you’re using the latest version of the plugin * Include your WordPress and PHP versions in your support request

Feature Requests: We welcome feature suggestions! Please post them in the support forum with detailed descriptions of your use case.

Source Code

This plugin uses build tools for development efficiency.

Compressed File Source Code: * build/index.js: WordPress Block Editor integration code * Source: blocks/markdown/src/ folder * Build: npm run build * assets/libs/shiki/shiki.min.js: Shiki syntax highlighter (self-contained bundle, no CDN) * Source: scripts/vendor/shiki-entry.mjs * Build: npm run vendor:shiki

Source Code Access: * GitHub Repository: https://github.com/my-biz-dev/markdown-renderer-for-github * License: GPL v2 or later * Development Branch: main

Build Instructions: 1. Install Node.js 22 LTS (see .nvmrc) 2. Install dependencies with npm install 3. Build with npm run build 4. Run tests with npm run test

Developer Resources: * Development Environment Setup: See CLAUDE.md and docs/DEVELOPMENT.md * Contributing: See CONTRIBUTING.md * Build Process Details: See BUILD.md

Third Party Services

By default this plugin runs entirely on your own server. The core rendering libraries are bundled locally and make no external requests:

  • Shiki syntax highlighter – served from your WordPress installation (no CDN)
  • Mermaid diagram renderer – served from your WordPress installation (no CDN)
  • Chart.js chart renderer – served from your WordPress installation (no CDN)
  • markdown-it parser – bundled locally

Optional features that contact an external server (opt-in, off by default):

Two features can send diagram source to an external rendering server. Both are inactive until you explicitly enable, configure a server URL, and accept the in-plugin privacy notice:

  • PlantUML diagrams – PlantUML has no in-browser renderer, so the source of each “`plantuml block is sent to a PlantUML/Kroki server to produce the image.
    • Default server (configurable, or self-hostable): https://www.plantuml.com/plantuml
    • Service: PlantUML – https://plantuml.com/
  • Server-side Mermaid rendering (Kroki) – an optional mode that pre-renders Mermaid diagrams on a Kroki server for faster first paint. When enabled, the Mermaid source is sent to the configured server.
    • Default server (configurable, or self-hostable): https://kroki.io
    • Service: Kroki – https://kroki.io/

To keep diagram source private you can point either feature at a server you self-host. When both options are left in their default (disabled) state, no diagram data or any other content leaves your site.

Privacy & Security Benefits (default configuration): * No tracking, analytics, or data collection * No data is transmitted to external servers unless you opt in to PlantUML or server-side Mermaid rendering * Works offline and in closed networks with the default settings

Privacy

This plugin does not collect any personal data, and with the default settings all processing happens locally on your server. If you opt in to PlantUML or server-side (Kroki) Mermaid rendering, the source text of those diagrams is sent to the rendering server you configure – choose a server you trust, or self-host one, for sensitive content.

Credits

Developer Information

This section provides essential information for developers who want to extend or customize the plugin.

For complete API documentation, architecture diagrams, and customization examples, see: Developer Documentation on GitHub

Available Hooks and Filters

Actions:

  • gfmr_metadata_saved – Fired when code block metadata is saved
    • Parameters: $post_id (int), $metadata (array)
    • Use case: Sync metadata with external services, logging

Filters:

  • gfmr_metadata_get_metadata – Filter retrieved metadata before use

    • Parameters: $metadata (array), $post_id (int)
    • Use case: Custom language detection, metadata modification
  • gfmr_schema_data – Filter Schema.org JSON-LD data before output

    • Parameters: $schema (array), $post (WP_Post)
    • Use case: Add custom schema properties, author profiles

PHP Constants

  • GFMR_PLUGIN_FILE – Plugin main file path
  • GFMR_SLUG – Plugin slug (‘markdown-renderer-for-github’)
  • GFMR_URI – Plugin URL
  • GFMR_PATH – Plugin directory path
  • GFMR_PLUGIN_PATH – Plugin directory name (relative)
  • GFMR_PLUGIN_BASENAME – Plugin basename
  • GFMR_ASSETS_PATH – Assets directory URL

JavaScript Global Objects

  • wpGfmConfig – Plugin configuration object
  • wpGfmRenderer – Core rendering API (processCodeBlocks, renderContent, initialize)
  • wpGfmHighlighter – Highlighter wrapper instance
  • wpGfmShikiHighlighter – Actual Shiki highlighter instance
  • wpGfmUnifiedHighlight(code, lang, options) – Unified highlight function
  • wpGfmSwitchTheme(newTheme) – Theme switching function (‘light’, ‘dark’, ‘system’)
  • wpGfmRenderDiagram(content, element, options) – Diagram rendering function

Settings Option

Option name: gfmr_theme_settings

Available keys:

  • theme – Theme setting (‘light’, ‘dark’, ‘system’)
  • schema_enabled – Enable Schema.org JSON-LD output (bool)
  • schema_auto_detect_type – Auto-detect article type (bool)
  • schema_include_author – Include author in schema (bool)
  • schema_include_publisher – Include publisher in schema (bool)

Plugin Development

This plugin follows WordPress coding standards and provides clean, semantic HTML output.

Detailed Documentation:

For complete documentation including full API reference with code examples, architecture diagrams (Mermaid), step-by-step customization guides, and CSS class reference, visit:

GitHub Developer Documentation

目前已測試版本
WordPress 7.0
此外掛程式已可供下載,並可用於你 系統。