• HOME
  • USER GUIDE
  • SHOWCASE
  • ABOUT
  • MarkBind CLI

    Overview

    MarkBind Command Line Interface (CLI) can be run in the following ways:

    • markbind [--version | -v]
      Prints the version number of the MarkBind installation in use.
      Examples: markbind --version, markbind -v
    • markbind [--help | -h]
      Prints a summary of MarkBind commands.
      Examples: markbind --help, markbind -h
    • markbind <command> [--help | -h] Print instructions specific to the given <command>.
      Examples: markbind build -h (prints instructions for the build command)
    • markbind <command> [<args>]
      Executes the given <command> with the given arguments. Available commands are described in the sections below.

    build Command

    Format: markbind build [<OPTIONS>]
    Alias: markbind b

    Description: Generates the site to the directory named _site in the current directory.

    OPTIONS:

    • <output>
      Put the generated files in the specified directory
      Example: ../myOutDir
    • <root> <output>
      Read source files from the <root> directory and put the generated files in the specified <output> directory
      Example: ./myWebsite ../myOutDir
    • --baseUrl <base>
      Override the baseUrl property (read from the site.json) with the give <base> value.
      Example: --baseUrl staging
    • -s <file>, --site-config <file>
      Specify the site config file (default: site.json)
      Example: -s otherSite.json

    Examples:

    • markbind build
    • markbind build ./myWebsite ./myOutDir
    • markbind build ./stagingDir --baseUrl staging

    deploy Command

    Format: markbind deploy [<OPTIONS>]
    Alias: markbind d

    Description: Deploys the site to the repo's Github pages by pushing everything in the generated site (default dir: _site) to the gh-pages branch of the current git working directory's remote repo.

    OPTIONS:

    • -t <githubTokenName>, --travis <githubTokenName>
      Deploy the site in Travis CI using the GitHub personal access token stored in <githubTokenName>. (default: GITHUB_TOKEN)
      Example: -t PA_TOKEN

    Related: User Guide: Deploying the Website.


    init Command

    Format: markbind init [<OPTIONS>]
    Alias: markbind i

    Description: Initializes a directory into a MarkBind site by creating a skeleton structure for the website which includes a index.md and a site.json.

    OPTIONS:

    • <root>
      Root directory. Default is the current directory.
      Example: ./myWebsite
    • -c, --convert
      Convert an existing GitHub wiki or docs folder into a MarkBind website. See Converting an existing Github project for more information.

    Examples:

    • markbind init : Initializes the site in the current working directory.
    • markbind init ./myWebsite : Initializes the site in ./myWebsite directory.
    • markbind init --convert : Converts the Github wiki or docs folder in the current working directory into a MarkBind website.

    serve Command

    Format: markbind serve [<OPTIONS>]
    Alias: markbind s

    Description: Does the following steps:

    1. Builds the site and puts the generated files in a directory named _site.
    2. Starts a web server instance locally and makes the site available at http://127.0.0.1:8080.
    3. Opens a live preview of the website.
    Live preview is the regenerating the site upon any change to source files and reloading the updated site in the Browser.

    Live preview works for the following file types only: css, .html, .md, .mbd, .mbdf. Changes to css might may not be visible in the site until you do a manual refresh of the page.

    Use the serve command to launch a live preview.

    OPTIONS:

    • <root>
      Root directory. Default is the current directory.
      Example: ./myWebsite
    • -f, --force-reload
      Force live reload to process all files in the site, instead of just the relevant files. This option is useful when you are modifying a file that is not a file type monitored by the live preview feature.
    • -n, --no-open
      Don't open a live preview in the browser automatically.
    • -o <file>, --one-page <file>
      Render and serve only a single page from your website.
      Example: --one-page guide/index.md
    • -p <port>, --port <port>
      Serve the website in the specified port.
    • -s <file>, --site-config <file>
      Specify the site config file (default: site.json)
      Example: -s otherSite.json

    Examples:

    • markbind serve
    • markbind serve ./myWebsite
    • markbind serve -p 8888 -s otherSite.json