KaTeX with VSCode, Jekyll, and WordPress Markdown

I use KaTeX in VSCode extension Markdown All in One for notes and homework. It's by far the easiest and most flexible way.

Markdown is such a markup language (see the paradox? lol) without a widely-accepted, strong official organization regularizing its syntax and grammar. Typical standards includes:

Implementation of Javascript libraries into Markdown, such as KaTeX, is done independently by Markdown processors, thus creating even more variants of syntax and grammar.

In an attempt to use the same syntax and grammar throughout my Markdown documents, i.e KaTeX with VSCode, Jekyll, and WordPress Markdown, and considering the possible transplantation to LaTeX, I adopt the following configuration for most consistent experience.

WordPress PHP short code to parse markdown

Requirements to include a markdown file from elsewhere emerged when I decide to auto update my blog with github readme page.

Since markdown itself cannot include another markdown file, I come up with a work around to parse the github raw on the air.

The following example requires wp-githuber-md - since I am already using it anyway. Any equivalent will do.

/*====== parse_md shortcode ======*/
function parse_md($atts = [])
{
    $src = $atts['src'];
    $md = file_get_contents($src);

    if ($md === false)
    {
        $html = "Could not load $src";
    }
    else
    {
        require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/plugins/wp-githuber-md/src/Modules/MarkdownParser.php";
        $markdownParser = new Githuber\Module\MarkdownParser;
        $html = $markdownParser->transform($md);
    }

    return $html;
}
add_shortcode( 'parse_md', 'parse_md' );

Usage

[parse_md src="<url>]

Hello, World!

Beginner

It’s been five days since I decided to build this site on a boring Sunday afternoon. Now that almost everything feels good, and I think it’s time I paused and wrote something.