Skip to content

Instantly share code, notes, and snippets.

@JayKickliter
Last active November 13, 2022 18:38
Show Gist options
  • Save JayKickliter/89ea75768a9b6506e13d18502a913a19 to your computer and use it in GitHub Desktop.
Save JayKickliter/89ea75768a9b6506e13d18502a913a19 to your computer and use it in GitHub Desktop.
Render github-flavored markdown (GFM) in emacs using `pandoc`

Command line usage

pandoc pandoc --quiet -f gfm -s somefile.md

What the options mean:

  1. --quiet: supress "[WARNING] This document format requires a nonempty <title> element."
  2. -f gfm: input format is Github Flavored Markdown
  3. -s: create standalone HTML5 with the formatting magic embedded in it
  4. somefile.md: the actual document you want to render

Emacs integration

In your init file

Using custom

  1. M-x customize-variable RET markdown-command RET
  2. Enter pandoc --quiet -f gfm -s in box like so:
For help using this buffer, see [Easy Customization] in the [Emacs manual].

                                         [ Search ]

Operate on all settings in this buffer:
[ Revert... ] [ Apply ] [ Apply and Save ]

Hide Markdown Command: pandoc --quiet -f gfm -s
   [ State ]: SAVED and set.
   Command to run markdown.
Groups: [Markdown]
@TheCodeHeist
Copy link

TheCodeHeist commented Nov 18, 2021

Sir can we embed HTML codes in .md file to use it in pdf!??

Here's a demo:

    # How to create a website from scratch

    First of all, we have to learn some native languages:

    1. **HTML** (**H**yper-**t**ext **M**arkup **L**anguage)
    2. **CSS** (**C**ascading **S**tyle**s**heet)
    3. **JS** (**J**ava**S**cript)


   ```js
   const body = document.querySelector("body");

   body.innerHTML = "HELLO, WORLD!";

<img src="./img.jpg" width="20px" alt="Badass coding!" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment