Skip to content
/ gm Public

Cli tool converting Markdown to HTML. This tool is a thin wrapper around the github.com/yuin/goldmark library.

License

Notifications You must be signed in to change notification settings

kpym/gm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ef330e7 Â· Jan 25, 2024

History

48 Commits
Apr 25, 2023
May 7, 2021
Apr 26, 2023
May 7, 2021
Nov 13, 2020
Oct 18, 2023
Apr 25, 2023
Jan 25, 2024
Apr 25, 2023
Dec 5, 2023
Oct 18, 2023
Apr 26, 2023
Jan 25, 2024
Jan 25, 2024
Sep 8, 2023
May 7, 2021
Oct 21, 2023

Repository files navigation

gm (a goldmark cli tool)

A cli tool converting Markdown to HTML. This tool is a thin wrapper around the github.com/yuin/goldmark library.

Usage

Single md to html

> gm file.md

Open (and watch) md file in the browser

> gm --serve file.md

The usage message

> gm -h
gm (version: --): a goldmark cli tool which is a thin wrapper around github.com/yuin/goldmark (versio: --).

  If not serving (no '--serve' or '-s' option is used):
  - the .md files are converted and saved as .html with the same base name;
  - if the .html file exists it is overwritten;
  - 'stdin' is converted to 'stdout';
  - when a pattern is used, only the matched .md files are considered.

  When serving (with '--serve' or '-s' option):
  - the .md files are converted and served as html with live.js (for live updates);
  - all other files are staticly served;
  - nothing is written on the disk.

  -s, --serve                    Start serving local .md file(s). No html is saved.
      --timeout int              Timeout in seconds for stop serving if no (non static) request. Default is 0 (no timeout).
  -c, --css string               A css url or the theme name present in github.com/kpym/markdown-css. (default "github")
  -t, --title string             The default page title. Used if no h1 is found in the .md file.
      --html string              The html template (file or string).
  -o, --out-dir string           The build output folder (created if not already existing, not used when serving).
      --links-md2html            Replace .md with .html in links to local files (not used when serving). (default true)
      --gm-attribute             goldmark option: allows to define attributes on some elements. (default true)
      --gm-auto-heading-id       goldmark option: enables auto heading ids. (default true)
      --gm-definition-list       goldmark option: enables definition lists. (default true)
      --gm-footnote              goldmark option: enables footnotes. (default true)
      --gm-linkify               goldmark option: activates auto links. (default true)
      --gm-strikethrough         goldmark option: enables strike through. (default true)
      --gm-table                 goldmark option: enables tables. (default true)
      --gm-task-list             goldmark option: enables task lists. (default true)
      --gm-typographer           goldmark option: activate punctuations substitution with typographic entities. (default true)
      --gm-emoji                 goldmark option: enables (github) emojis 💪. (default true)
      --gm-unsafe                goldmark option: enables raw html. (default true)
      --gm-hard-wraps            goldmark option: render newlines as <br>.
      --gm-xhtml                 goldmark option: render as XHTML.
      --gm-highlighting string   goldmark option: the code highlighting theme (empty string to disable).
                                 Check github.com/alecthomas/chroma for theme names. (default "github")
      --gm-line-numbers          goldmark option: enable line numering for code highlighting.
  -q, --quiet                    No errors and no info is printed. Return error code is still available.
  -h, --help                     Print this help message.

How to

For more usage information check the HOWTO documentation.

Installation

Precompiled executables

You can download the executable for your platform from the Releases.

Compile it yourself

Using Go

$ go install github.com/kpym/gm@latest

Using goreleaser

After cloning this repo you can compile the sources with goreleaser for all available platforms:

git clone https://github.com/kpym/gm.git .
goreleaser --snapshot --skip-publish --clean

You will find the resulting binaries in the dist/ sub-folder.

License

MIT