Using Markdown in WordPress

Intro

I have been meaning to understand and work with markdowns for a while here.

 

Platform

Let us setup our platform first.

WordPress

Enable Markdown in Posts and Pages

From here, here is how to enable markdown in WordPress Posts and Pages:
To enable Markdown for posts and pages, go to Settings → Writing in your dashboard, and check the box labeled Use Markdown for posts and pages.
Click on Save Changes at the bottom of the page to apply. You will now be able compose posts and pages using Markdown.

 

And, to to enable markdown in Comments:

To enable Markdown for comments, go to Settings → Discussion in your dashboard, and check the box labeled Use Markdown for comments.
Click on Save Changes at the bottom of the page to apply.

 

Tags

Inline Links

To use inline links, enter the link text and surround it in square brackets.

And, enter the URL and surround in parenthesis.

Please make sure that there are no spaces between the ending square bracket and the parenthesis.

Here is a [link](http://github.com/DanielAdeniji/ "GitHub") to my GitHub repository.

Referenced Links

To use referenced links, enter the link text and surround it in square brackets.

And, enter a numeric ID to the URL you will later identify.

The numeric ID should also be enclosed in square brackets.

Later enter the Identifying ID. Enclose that in square brackets, as well.

A colon should follow and the URL should then be expressed.


A) Markdown - Basics [Link] [201]
B) Codebase - syntax-highlighting-in-markdown [Link][202]

[201]: https://daringfireball.net/projects/markdown/basics
[202]: https://support.codebasehq.com/articles/tips-tricks/syntax-highlighting-in-markdown "Dan Quinney"

Mixed List

Mixed List can be entered with numeric IDs to indicate the top list.

And, indented asterix to precede the nested list.


1. United States
     * California
     * Florida
     * New York
     * Texas
2. Canada
     * Nunavut
     * Quebec
     * Northwest Territories
     * Ontario
     * British Columbia
     * Alberta

Code Block

Code Block – C#

Code blocked can be entered within three ~ or `. The language identifier shall follow.

And, corresponding ~ ( ~~~ ) or ` ( “`) should indicate the completed code block.


~~~csharp
public main()
{
    Console.WriteLine("hello world");
}
~~~

Code

Links

Sample Inline Link

Here is a link to my GitHub repository.

Referenced Links

A) Markdown – Basics Link
B) Codebase – syntax-highlighting-in-markdown Link

Mixed Lists

  1. United States
    • California
    • Florida
    • New York
    • Texas
  2. Canada
    • Nunavut
    • Quebec
    • Northwest Territories
    • Ontario
    • British Columbia
    • Alberta
  3. Australia
    • Multi-state/territorial
    • New South Wales
    • Northern Territory
    • Queensland
    • South Australia
    • Tasmania
    • Victoria
    • Western Australia

Code Block

Code Block – XML

<!--?xml version="1.0"?-->

<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications 
      with XML.</description>
   </book>
   <book id="bk102">
      <author>Ralls, Kim</author>
      <title>Midnight Rain</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
      <publish_date>2000-12-16</publish_date>
      <description>A former architect battles corporate zombies, 
      an evil sorceress, and her own childhood to become queen 
      of the world.</description>
   </book>

</catalog>

Code Block – C#

public main()
{
      Console.WriteLine("hello world");
}

Critique

I think if you attempt to use markdowns in WordPress posts, you will run into problem such as

  • markdown contents will be lost as you switch from Text to Visual Mode
  • There is a bit of “forciness” as to where whitespaces can go

References

  1. John O’Nolan – How to Write Faster, Better & Longer: The Ultimate Guide to Markdown
  2. John Gruber – Daring fireball – Markdown: Basics
  3. Codebase – Syntax highlighting in markdown
  4. WordPress – Markdown quick reference

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s