How to make Github Pages markdown content look like the one on Github

41 Views Asked by At

Apparently, Github Pages uses a different markdown processor than the one used by Github. I am having trouble trying to render mathematical expressions like $O(N^2)$ on GitHub pages which work fine on Github

In my project, I only have a bunch of markdown files organized into folders without any Jekyll config files or custom Github workflows set up. I tried just creating a _config.yml file in project root with one line as markdown: GFM but that didn't work

Also, decorated highlights like the one below works on Github but not on Github Pages

> [!NOTE]
> Some insightful text
1

There are 1 best solutions below

0
M69k65y On

The approach you're taking of setting the Markdown processor in _config.yml requires you to use Jekyll. (See docs)

To add similar functionality, you will need to manually add support in your Markdown files.

For mathematical expressions, you can do so by using a tool like MathJax.

In your Markdown file:

<script type="text/javascript"
    src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

Centred formulae: 

\\[ x = {-b \pm \sqrt{b^2-4ac} \over 2a} \\]


Inline formulae:

\\( x = {-b \pm \sqrt{b^2-4ac} \over 2a} \\)

To add support for styling of blockquotes, simply add the desired CSS rules to your Markdown files.

<style>
    blockquote {
        /* style rules */
    }
</style>