I treat my WordPress blog as my “digital home” – THE place to collect my thoughts, describe projects, and publish ideas.
It works very well for writing, but my coding projects feel better on Github. They also appreciate the documentation and descriptions I attach to them.
Over time, my projects would get out of sync with their WordPress counterparts. I would add new features, change behavior or describe new use cases and would have to manually change that in WordPress, which I naturally forgot to do.
I wrote this simple snippet to embed any Github .md file inside WordPress posts or pages. Content would be refreshed from Github every hour and displays inside the post like it was written on WordPress.
How to sync your WordPress posts with any markdown file on Github
- Use the attached code to introduce the GitHub markdown handler to your WordPress blog. Remember to also attach Parsedown.php!
- Create an amazing project solving the world’s most pressing problem, write a .md file describing it
- Copy the URL to Github markdown file
- Paste it to WordPress block editor, and see how it turns into the content from the file.
Here is the code: