Giter VIP home page Giter VIP logo

markmap.nvim's Introduction

Markmap.nvim

Visualize your Markdown as mindmaps with markmap

screenshot_2023-05-25_02-51-13_907564300

Motivation

This plugin is based on vim's coc-markmap, which I missed when moving to Neovim. If you wanna know more about mindmap check their website, docs and GitHub repository. This plugin is compatible with Linux, MacOS, Windows, and Android Termux.

Requirements

  • yarn

How to install using lazy.nvim

--  [markdown markmap]
--  https://github.com/Zeioth/markmap.nvim
{
  "Zeioth/markmap.nvim",
  build = "yarn global add markmap-cli",
  cmd = { "MarkmapOpen", "MarkmapSave", "MarkmapWatch", "MarkmapWatchStop" },
  opts = {
    html_output = "/tmp/markmap.html", -- (default) Setting a empty string "" here means: [Current buffer path].html
    hide_toolbar = false, -- (default)
    grace_period = 3600000 -- (default) Stops markmap watch after 60 minutes. Set it to 0 to disable the grace_period.
  },
  config = function(_, opts) require("markmap").setup(opts) end
},

How to use

Markmap.nvim provide the next commands:

Command Description
:MarkmapOpen Open markmap
:MarkmapSave Save markmap without opening it
:MarkmapWatch Open markmap and watch for changes
:MarkmapWatchStop The watch server ends automatically after a grace period, or when closing nvim. But it can also be stopped manually with this command.

Note that all these commands will always generate a .html file in html_output. Take advantage of this if you want to keep the graph.

Troubleshooting

Run :healthcheck markmap. This command will tell you the depencencies you are missing. If the command do not exist, it means you are using an async package manager, so double check the package is beign loaded. These are the most common issues you will find:

  • Run
yarn global add markmap-cli
  • Now try to run
markmap

If the executable is not found, that means you need to add yarn to your PATH. This is normally done in your .profile, bashrc, or zshrc file like this:

# PATH Example
export PATH="$HOME/.local/bin:\
$HOME/.cargo/bin:\
$HOME/.npm-global/bin:\
$HOME/.yarn/bin:\
$HOME/.config/yarn/global/node_modules/.bin:\
$HOME/.local/share/gem/ruby/3.0.0/bin:\
$HOME/.cargo/env:\
/root/.local/share/gem/ruby/3.0.0/bin:\
/usr/local/bin:\
/usr/share/nvm/init-nvm.sh:\
$PATH"

If you prefer using npm over yarn, you can, but double check that you have the user space correctly configured as in some systems this is not enabled by default (see here).

If you are on windows, the process is the same. But the place to set PATH may change from one windows version to another.

๐ŸŒŸ Support the project

If you want to help me, please star this repository to increase the visibility of the project.

Stargazers over time

markmap.nvim's People

Contributors

marcobuess avatar zeioth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

markmap.nvim's Issues

Dark Mode

Hey, nice project, any way to configure the background color scheme?

Bug: using jobstart({}) causes problems on Android

Description

The reason is

  • jobstart("mytask") runs the task in shell.
  • jobstart({ "mytask" }) runs the task directly in the operative system.

That means if you are defining your PATH in the shell, it won't be available, like it's the case on termux. This provokes termux can't find the executable.

Possible solutions

Option 1

  • Let's try to run it without {}. Windows shouldn't be stupid enough to spawn a shell process. Ideally neovim takes care of it.

Option 2

Use this option if 1 don't do the trick.

  • Instead of running jobstart directly, create a wrapper, so we can choose one or the other depending the OS.
  • That way we could run directly on windows, and on shell on UNIX.

[suggestion] improved watch stop

@Zeioth I wonder if it would make sense, instead of tracking the last execution over a grace period to rather capture the buffer that is currently served and monitor the last write time. Then go and reset the grace period when the buffer was recently written, as one could assume that you are still working on the document. I haven't looked up what the default grace period is but serving just randomly stopped after ~1h when I was still editing the document.

Plugin currently broken on Windows

open and watch currently don't work anymore. I suspect an issue with the temp path, that could've been introduced in d995509. When you run MarkmapWatch it creates a file named --watch in the cwd. This could be because no default opts are provided. So if you don't explictly configure the paths in your options it will lead to a "" situation.

Guard for markdown files

It is currently possible to launch markmap from any buffer regardless of filetype. There should be something that guards vim.bo.filetype == "markdown" and just do nothing if current file is not of type markdown.

Usercmds dont start markmap on Windows

Environment

Windows 10: 10.0.19045

NVIM v0.9.4
Build type: RelWithDebInfo
LuaJIT 2.1.1696883897

Checkhealth

markmap: require("markmap.health").check()

markmap.nvim ~
- Neovim Version: v0.9.4
- OK Using stable Neovim >= 0.8.0
- OK `git` is installed: Used for core functionality such as cloning markmap.nvim
- OK `node` is installed: Used for core functionality such as running markmap-cli
- WARNING `yarn` is not installed: Used to install markmap-cli. This operation can also be performed using npm instead, or even manually. See README.md for more info:/nhttps://github.com/Zeioth/markmap.nvim
- OK `markmap` is installed: Used to for the main functionality of the plugin. markmap-cli must be executable in a terminal.

Swapping markmap with markmap.cmd in

job = uv.spawn("markmap", { args = arguments, detached = true }, nil)
seems to fix the issue. I used npm instead of yarn to install it, which should not be an issue from my understanding.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.