Command-line tool


     cat foo.md | mm html-fragment > foo.html
     cat foo.md | mm html-page     > foo.html
     cat foo.md | mm ast-json      > foo.json
zip -0 -r - md/ | mm zip2zip       > website-build.zip
        cd md/ && mm live-preview

For configuration, see:

live-preview

This section describes its command-line options.

For the main page on this feature, see:

cd md/ && mm live-preview

alias lp='mm live-preview --allow-external-connections'

When you start the live preview server, it shows you a URL you can go to to see the live preview page, e.g.:

$ mm live-preview

→ http://localhost:3000/?access_token=c6ab58bc2b0d4834e204cad5978d3cd0

Note: an access token is always required to see the live preview page. It's randomly generated when you start the server, and included in the URL it shows you.

Options

--allow-external-connections

By default, the live preview server only accepts network connections the same computer.

If you want to see the live preview page from another computer on your local network (e.g. a phone or tablet connected to the same Wi-Fi), you'll need to specify --allow-external-connections, which will accept connections from any computer. In networking terms, the server will listen on 0.0.0.0 instead of 127.0.0.1.

This will accept connections from any computer that can send network packets to your computer. But with most network routers / internet connections, you're behind a NAT and other computers probably cannot talk to yours unless they're on the same LAN.

Some service such as ngrok can help in that scenario.

The initial message now includes more information:

$ mm live-preview --allow-external-connections

  Now accepting connections from any computer, due to the --allow-external-connections option.

  Note: if you want to enable HTTPS/TLS, use the --tls option

→ QR code: http://192.168.1.456:3000/qr?access_token=9f5be4be61e6f53172434da1c473d778

→ LAN URL: http://192.168.1.456:3000/?access_token=9f5be4be61e6f53172434da1c473d778

Note: this might be accessible from the internet via a different IP, depending on your network configuration.

--tls (TODO)

TODO

zip2zip

zip -0 -r - md/ | mm zip2zip > website-build.zip

Options

--docset-root

In most contexts, you don't need this option.

For example, suppose you have this file layout:

some-monorepo/
  foo/
    site/
      .MarkdownMesh.json
      ...
    src/
      ...
  bar/
    site/
      .MarkdownMesh.json
      ...
    src/
      ...

...and that you want to pass the entire monorepo as a zip file to zip2zip.

Possible reasons for this include:

In this scenario, you'll need to specify --docset-root foo/site/

html-fragment

cat foo.md | mm html-fragment > foo.html

For example, [Foo](#foo) renders to:

<p><a href="#foo">Foo</a></p>

html-page

cat foo.md | mm html-page > foo.html

This renders Markdown to HTML of the form:

<!DOCTYPE html><html>…</html>

ast-json

cat foo.md | mm ast-json > foo.json

Setting up an alias

alias mm='MarkdownMesh'