What Is Markdown, and How Do You Use It?


    Markdown logo on a blue background

    Markdown is a simple syntax that formats text as headers, lists, boldface, and so on. This markup language is popular, and you definitely have apps that support it. Here’s a quick primer on what Markdown is, and how and where you can use it.

    What Is Markdown?

    When you add bold, italics, numbered lists, bullet points, headings, and so on to text, you’re “formatting” it. Markdown is a syntax—or, set of rules—that formats text on web pages.

    Traditionally, to format text on web pages, people used Hypertext Markup Language, better known as HTML. HTML is one member of the family of markup languages, along with eXtensible Markup Language (XML) and Standard Generalized Markup Language (SGML).

    To format text with HTML, you put tags around the text. For example, if you want to bold text, you type “<b> this is some bold text </b>”.

    When your web browser “reads” a web page, it interprets the HTML tags and applies the relevant formatting. When it sees “<b> this is some bold text </b>”, it understands that anything between the <b> and </b> tags should appear in bold. The browser also hides the tags (<b> and </b>).

    HTML can be quite complex, with dozens and dozens of tags, such as <span>, <div>, <kbd>, <ol>, and lots of others. Computers have no trouble reading these because they just follow the syntax (the rules of HTML) and apply the formatting that matches the tags.

    The tags, however, make it quite difficult for humans to read HTML and understand how the text will look after the computer renders it. It’s not very “user-friendly” for people who don’t have a lot of experience reading it.

    RELATED: How to View the HTML Source in Google Chrome

    Markdown, on the other hand, is meant “to be as easy-to-read and easy-to-write as is feasible.” John Gruber and Aaron Schwartz explain why they created Markdown in 2004 and provide a guide to the syntax on Gruber’s website.

    In short, Markdown makes it easier to format text for web pages because its tags are simpler than HTML, and they convert to HTML automatically. This means you don’t have to know HTML to write something for a web page because Markdown translates your tags into HTML for you.

    It doesn’t cover all possible HTML tags, but, rather, the most common formatting options.

    How Do You Use Markdown?

    To use Markdown, you just apply simple tags to your text. For example, to format text in italics, you put underscores around it like so: _this is some text in italics_.

    Here are some other examples of Markdown formatting from the syntax guide:

    Headers

    # This is an H1

    ## This is an H2

    ###### This is an H6

    Bullet Points

    * Red
    * Green
    * Blue

    Numbered Lists

    1. Bird
    2. McHale
    3. Parish

    Emphasis (Italics)

    *text*
    _text_

    Markdown converts both *text* and _text_ to the HTML <emphasis> or <em> tag, which, in theory, can be interpreted in many ways. For example, you could build an app that interprets the <emphasis> tag as flashing red text. In practice, however, almost every application (including every web browser) interprets it as italicized text.

    Strong (Bold)

    **text**
    __text__

    Markdown converts both **text** and __text__ to the HTML <strong> tag, which typically appears as bolded text. In other words, for additional emphasis, use double * or _ characters.

    There are also variants of Markdown—such as CommonMark and GitHub Flavored Markdown (GFM)—but these are all based on the original Markdown specification. Variants usually just extend the standard by adding formatting tags the original Markdown doesn’t cover.

    After you format your text, an application has to convert it to HTML, which is usually done automatically. For example, README files in GitHub use Markdown, and as long as they have a .MD file extension, GitHub automatically converts them to the correct HTML tags when they’re published.

    So, in most cases, you won’t have to do this yourself, but if you do, there’s a Markdown tool available.

    RELATED: What Is GitHub, and What Is It Used For?

    Where Can You Use Markdown?

    As we mentioned above, you can use Markdown on GitHub, but also on Reddit, StackOverflow, and other websites. If you’ve ever formatted text in WhatsApp messages or Slack conversations, you’ve already used it because these applications use a (very small) subset of Markdown tags to format text.

    If you want to learn Markdown, check out the original Markdown syntax guide or a third-party tutorial site. It’s easy to learn, and it’ll make your README files, and Reddit or StackOverflow comments easier for others to read.





    Source link

    Previous articleAfter Bitcoin, Tesla now accepts Dogecoin cryptocurrency for merchandise purchase
    Next articleDogecoin Sees Monthly High Following Tesla News (Market Watch)