DONN FELKER

Lessons Learned From the Software Industry

  • Home
  • About
  • Development Training
  • Fragmented Podcast
  • Learn to Work for Yourself
  • Contact

Connect

  • GitHub
  • Google+
  • Instagram
  • LinkedIn
  • RSS
  • Twitter

Powered by Genesis

WP Markdown Themes for Google Code Prettify

June 5, 2018 by Donn Felker Leave a Comment

Writing in Markdown is probably one of the best experiences you can have for a technical writer for a few simple reasons –

  • Its easy to write with
  • The limitations of Markdown are actually a benefit (less is more)
  • Theming can be applied

If you’re using markdown to write your blog posts, you can post them to your WordPress site if you’re using the wp-markdown plugin you can easily get code to show up in a formatted code block by simply adding the back ticks or tab spacing.

This is great, except the default theme is not the greatest.

Under the hood, wp-markdown uses Google code-prettify, which allows theming. Thankfully, many kind folks have created themes for code-prettify and shared them online. I found one I really liked here. The problem was, how do I get this theme applied to the wp-markdown plugin? It’s quite simple …

Applying a New Theme to WP Markdown

Important Note: Before modifying any theme or plugin files it is recommended that you back your site up just in case you completely bork something.

To update the theme you want to use on WP Markdown, simply go to your WordPress dashboard and then go to Plugins > Editor.

Plugin Editor

From there, you’ll select the WP Markdown plugin and then you’ll click Select.

Next, you’ll open the css folder on the right hand side and select the prettify.css file.

Once this file is open in the editor, you’ll take the theme CSS that you want to use (I grabbed one from here and modified it to my needs) and you’ll replace the prettify.css file contents with the file contents of the theme of your liking. Then you’ll click Update File.

Plugin Update

Thats it, your site should now be using the new code-prettify theme that you specified!

Caveats

Warning

You may have noticed that WordPress has this nice little warning:

Warning: Making changes to active plugins is not recommended.

This is true, you need to be sure what you’re doing here. If you edit the wrong file, you could completely host your WordPress installation. Be careful here.

Site does not reflect changes after updating the theme?

If you have any caching plugins, be sure to purge the cache. This can also happen if you run on sites like WP Engine, be sure to flush their cache. Also, if you’re running on a CDN, make sure the CDN file is updated. I had a CDN enabled and it was not picking it up until I flushed everything and reseeded it.

Updating the plugin will probably destroy your changes

When you you update a plugin, a new version of the plugin is downloaded and installed over the top of the old one (more or less). This can, and usually will wipe out any changes you made to your plugin (Ala what we did in this post). To make life easier, save the css that you put into the prettify.css file into an online site like gist.github.com so that when you do update your plugin you can easily repeat these steps with your updated theme (because the plugin update will wipe out your updates).

Enjoy!

Filed Under: Development, Marketing, Misc Tagged With: markdown, wordpress

Donn Felker Google Android GDE Fragmented - An Android Developer Podcast

Projects / Apps

Caster.IO
Fragmented Podcast
American Express Android
Aaptiv
AndroidJobs.IO
Groupon
MyFitnessPal
Poynt

Books

  • Android Developer Tools
  • Android App Dev For Dummies V2 (V1)
  • Android Tablet App Dev for Dummies

Categories

  • Book
  • Business
  • Development
  • Health
  • Marketing
  • Misc
  • Mobile
  • Screencasts
  • Uncategorized