Is it possible to change font type in Markdown?

Tom Humiston tom at jumpingrock.net
Sun Mar 22 14:03:14 EDT 2015


Markdown doesn't contain font information. So at the level of Markdown there's nothing to change.

Markdown contains structural information. For instance, a paragraph is a paragraph no matter what font your present it with. Things like colors, margins, backgrounds, and fonts are presentational, not structural.

Once your Markdown document has been rendered as HTML, then fonts can be applied. To specify a font for all or part of an HTML document, use CSS. Here's an example of a brief HTML document with embedded 'style' element (style elements use CSS syntax):


    <!DOCTYPE html>
    <head lang="en">
    <title>Sample document</title>
    <meta charset="utf-8">
    <style>
    body {
      margin: 2em auto;
      width: 90%;
      max-width: 30em;
      font-family: Verdana, Helvetica, sans-serif;
      }
    p {
      color: red;
      font-family: Georgia, "Times New Roman", serif;
      }
    </style>
    </head>
    <body>
    
    <h1>Sample Pages for Fun and Profit</h1>
    <p>This paragraph is red and in a different
    font! Woo-hoo!
    
    </body>
    </html>


The entire Markdown document for creating the above would contain only the following:


    # Sample Pages for Fun and Profit

    This paragraph is red and in a different
    font! Woo-hoo!


So, as shown above, font info just ain't there in a Markdown doc. The additional info to create a complete HTML document comes from outside the Markdown doc itself.

To set up individual elements for special styling, you can specify ID or class names if you're using a Markdown variant that supports it, and then supply rules for those elements in the CSS.

I'm guessing that for your purposes, the most productive next step is to search for "css tutorial".

HTH,
- Tom



On Mar 22, 2015, at 12:59 PM, Alan Goldsmith <alangoldsmith at gmail.com> wrote:

> If so, what's the tag?  Apologies if you've already discussed this.



More information about the Markdown-Discuss mailing list