jakewvincent / mkdnflow.nvim

Fluent navigation and management of markdown notebooks
GNU General Public License v3.0
695 stars 41 forks source link

Bug: Regular expression in non-markdown file is treated like a link and collapsed #153

Closed vonshednob closed 11 months ago

vonshednob commented 1 year ago

I suspect that I’m doing something wrong in my configuration, because I observe the following behaviour in neovim with mkdnflow. I have a regular expression in my Python code:

pattern = r'^([0-3][a-z]+)'

The problem is: As soon as I leave the line with the cursor, the ([0-3][a-z]) part is collapsed to (0-3) as if it was a link in a markdown document.

That’s very unfortunate, as I can’t quite see how I can disable Mkdnflow for this buffer, so I can actually read the regex when I’m not with the cursor on that line.

Any advice is highly appreciated.

Maybe useful. This is the snippet from my initialisation of neovim:

require('mkdnflow').setup({
    modules={
        bib = true,
        buffers = true,
        conceal = true,
        cursor = true,
        folds = false,
        links = true,
        lists = true,
        maps = true,
        paths = true,
        tables = false,
        yaml = false,
    },
    filetypes={
        md=true,
        markdown=true,
    },
    links={
        conceal=true,
        style='markdown',
        implicit_extension='.md',
    },
})
calon commented 1 year ago

try to set conceal to false? or you can create a shortcut to toggle the conceal setting.

vonshednob commented 1 year ago

Fair enough, but is it the intention of Mkdnflow to be active in Python strings?

Also, when I disable concealing (even with some autocommand), wouldn't that disable concealing globally? So when I have my notes open in a different buffer at the same time as python code, it would disable concealing for that other buffer, too?

jakewvincent commented 1 year ago

Hi @vonshednob, this is definitely not intended, and the plugin shouldn't be active in non-markdown buffers either. Can you tell me a bit more about your python/markdown workflow? Is a markdown buffer active in the same window at all before you open the python script? Or is this occurring in a python code chunk in a markdown buffer?

vonshednob commented 1 year ago

Good point, I've been trying to reproduce the issue, but failed.

I seem to recall that I had a couple of instances of nvim open, some running with Mrkdnflow, some with python and all of them running for quite some time with a bunch of tabs, splits, and hidden buffers.

Reloading the buffer (:e) didn't fix the problem, that much I'm sure of.

I'll try to get a more or less stable reproduction scenario going. Things become a bit blurry at that point whether it's an nvim or Mkdnflow issue, I suppose :thinking:

jakewvincent commented 11 months ago

Just pushed some updates to the conceal module that will hopefully prevent this from occurring again. Closing.

vonshednob commented 11 months ago

Thanks a lot!