Install
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/kissplugins/kiss-markdown-viewer/archive/refs/heads/main.zipA lightweight “Keep It Simple, Stupid” Markdown viewer for WordPress. Render .md files in the admin area or on the front end with minimal setup. Other plugins can hook in or fall back if it’s not installed.
Table of Contents
Installation
- Upload the plugin folder (
kiss-markdown-viewer/) to your/wp-content/plugins/directory. - Ensure the
vendor/parsedowndirectory is present (bundled or via Composer). - Activate KISS-markdown-viewer through the Plugins screen in WordPress.
Usage
Admin Preview
- Navigate to KISS Markdown Viewer → MD Preview to preview any
.mdfile in the plugin folder.
Front-End Shortcode
echo do_shortcode( '[kiss_mdv_render file="docs/my-doc.md"]' );
Or directly in post/page content:
[kiss_mdv_render file="docs/my-doc.md"]
Developer API
Programmatically render Markdown:
if ( function_exists( 'kiss_mdv_render_file' ) ) {
$html = kiss_mdv_render_file( '/path/to/file.md' );
} else {
// Fallback to plain text rendering
$markdown_file = '/path/to/file.md';
if ( file_exists( $markdown_file ) ) {
$content = file_get_contents( $markdown_file );
$html = '<pre>' . esc_html( $content ) . '</pre>';
} else {
$html = 'Markdown file not found.';
}
}
Shortcode
-
Tag:
[kiss_mdv_render file="relative/path/to.md"] -
Attributes:
file(required) – Path relative to the plugin root directory.
Filters & Actions
-
Filter:
kiss_mdv_renderer_htmlModify the rendered HTML before output:add_filter( 'kiss_mdv_renderer_html', function( $html, $file ) { // Alter $html as needed return $html; }, 10, 2 ); -
Suggested Action:
kiss_mdv_renderer_before_renderHook before parsing:add_action( 'kiss_mdv_renderer_before_render', function( $file ) { // Pre-render logic } );
Changelog
1.0.1
- Updated the example API call in the documentation to include a fallback that displays the Markdown file as plain text.
1.0.0
- Initial release: basic parsing, admin preview, shortcode, and API hooks.
Upgrade Notice
1.0.0
Initial stable version.
License
This plugin is distributed under the terms of the GNU General Public License v2.0. See the license text for details.