Skip to content

Preview markdown in web browser. Implemented with Lua and Node.js.

License

Notifications You must be signed in to change notification settings

asana17/prev-mark.nvim

Repository files navigation

prev-mark.nvim

Open the current buffer Markdown in a Web browser with :PrevMark.

Install

  • lazy.nvim

    local plugins = {
      {"asana17/prev-mark.nvim"},
    }

    Or you can use the local one.

    local plugins = {
      {"prev-mark", dir = "~/prev-mark.nvim"},
    }
  • Configuration Setup

    Following setup is using default values.

    require("prev-mark").setup(
      {
        verbose = false,
        server = {
          port = 8000,
          wait_limit = 1000, -- limit time in ms to wait for server to start
        },
        preview = {
          directory = "<plugin_dir>/.preview", -- directory to place preview temporaly files
          css = "<plugin_dir>/node/config/preview.css", -- CSS attached to the preview
          open_browser = true, -- open browser if true, otherwise do not open
          browse_command = "", -- command to start browser
          show_url = false, -- show the preview file URL in the small window
        },
      }
    )

Preview on remote server

Access preview URL from local browser. This requres following steps.

Specify following configuration:

require("prev-mark").setup(
  {
    server = {
      port = 8001,
    },
    preview = {
      open_browser = false, -- do not open the browser
      show_url = true, -- show the url in the small window
    },
  }
)

Connect remote server with ssh port forwarding:

ssh -L 8001:localhost:8001 user@remote

To suppress the open error from ssh, use quiet option -q.

Host remote
  HostName remote
  User user
  RemoteForward 8001 localhost:8001
  LogLevel QUIET

Before commit

Use pre-commit. Follow the official Quick start.

pre-commit install -t pre-commit -t commit-msg

Use Conventional Commits.

About

Preview markdown in web browser. Implemented with Lua and Node.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published