MeanderingProgrammer / render-markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
1.37k stars 32 forks source link

feature: Add another obsidian.nvim workaround to README.md #116

Closed pachungulo closed 1 month ago

pachungulo commented 1 month ago

Is your feature request related to a problem? Please describe.

I enjoy using markdown.nvim. However, I do find it a little bit more heavyweight than the built in ui to obsidian.nvim. The ideal solution would be to use both. If only there were a way to do that.... so I made one!

return {
  "MeanderingProgrammer/markdown.nvim",
  main = "render-markdown",
  name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim
  cmd = { "RenderMarkdown" },
  -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite
  -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins
  dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, -- if you prefer nvim-web-devicons
  config = function()
    local client = require("obsidian").get_client()
    client.opts.ui.enable = false
    local namespaceID = vim.api.nvim_get_namespaces()["ObsidianUI"]
    vim.api.nvim_buf_clear_namespace(0,namespaceID,0,-1) -- Clear all the obsidian UI stuff before loading this.
    require("render-markdown").setup({})
  end
}

Running the changes made to config after the plugin loads turns off the obsidian ui and clears it, then enables markdown.nvim! Loading is triggered by running the command RenderMarkdown.

Describe the solution you'd like

Simply add my code to the obsidian.nvim section of README.md. I'd be happy to submit a PR myself if you'd like!

Describe alternatives you've considered

I have considered using only markdown.nvim, but I didn't editing in it as much as I liked reading in it as a sort of preview. This solution allows me to have my cake and eat it too, and I was thinking other people would like to see it. Up to you!

Additional information

No response

MeanderingProgrammer commented 1 month ago

Sure added: https://github.com/MeanderingProgrammer/markdown.nvim?tab=readme-ov-file#obsidiannvim

Definitely a use at your own risk kind of thing, but more options are always good.

Thanks!