Markdown and Code

Background

Unfortunately, some of the code shared online is not always well formated.

 

Markdown

Thankfully markdown offers a way to add code to blog posts and comments.

 

Convention

To add markdown, please prefix with three backticks ( “`) followed by the language.

Embed code.

And, closeout by adding the same three backticks ( “`).

 

Language Tags

Language Language Designator
SQL sql
javascript javascript
C# cs
Python py
XML xml
Text text

Code

SQL – Transact SQL

Code

````sql
create table [dbo].[member]
(
       [id] bigint not null
            identity(1,1)

     , [name] nvarchar(120)

     , [tsCreated] datetime not null
            default getdate()

     , [tsUpdated] datetime

)

````

Output

create table [dbo].[member]
(
         [id] bigint not null
             identity(1,1)

       , [name] nvarchar(120)

       , [tsCreated] datetime not null
                     default getdate()

       , [tsUpdated] datetime

)

Summary

Rather, unfortunately, WordPress often jumbles up markdowns while editing posts.

 

References

  1. WordPress
    • Using Markdown on WordPress
      Link
  2. Markdownmonster
    • Embedding Code Snippets
      Link
  3. Codeproject
  4. StackOverflow
    • markdown GitHub syntax for C#
      Link

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s