This is a plugin for Wordpress to embed Markdown files from external web sources (e.g. GitHub, GitLab, etc) into WordPress content.
This is a plugin for WordPress to embed Markdown files from external web sources (e.g. GitHub, GitLab, etc) into WordPress content using the shortcode [external_markdown]
. A possible use case for this is to show content from a single source of truth (like a GitHub repository) on your WordPress website.
Download and unpack or clone this repository into your wp-content/plugins
folder, so the PHP file resides in wp-content/plugins/external-markdown/external-markdown.php
.
If you use the Guttenberg editor, you need to add a “Shortcode” block first. If your’re using the classic editor, you can use the shortcode right away.
The url
parameter takes the URL to the Markdown file you want to embed. Make sure to use the “raw” URL when you use GitHub, GitLab, etc.[external_markdown url="https://raw.githubusercontent.com/pReya/wordpress-external-markdown/main/README.md"]
The ttl
parameter controls how long the cached version is used, before it’s fetched again. The value is given in seconds. So 24 hours (24* 60 *60) result in a value of 86400.[external_markdown ttl=86400 url="https://raw.githubusercontent.com/pReya/wordpress-external-markdown/main/README.md"]
The class
parameter takes your desired class name for the external markdown container. The default class name for the container is class='external-markdown'
.[external_markdown class="my-classname" url="https://raw.githubusercontent.com/pReya/wordpress-external-markdown/main/README.md"]
When embedding content from Git hosting services like GitHub or GitLab, you need to make sure to use the proper “raw” markdown URL. You can find this URL in the upper right corner of the web view.