Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve UX of conceallevel UI warning #307

Merged

Conversation

larrybotha
Copy link
Contributor

@larrybotha larrybotha commented Jan 6, 2024

With the current implementation, the warning is always shown under the following conditions:

  • conceallevel is something other than 1 or 2 globally
  • the user sets conceallevel = 1 | 2 locally for markdown files, but opens Neovim with a buffer that is not markdown

This can be cumbersome if:

  • the user's config runs obsidian.setup in a non-Obsidian repo and conceallevel is not 1 or 2
  • the user sets conceallevel for markdown files only, but opens Neovim in an Obsidian repo on a non-markdown file

This PR addresses these scenarios by:

  • using an autocommand to assert conceallevel on BufEnter only for markdown files
  • only runs the autocommand once per call of obsidian.setup

ref #286

EDIT: add friction points, add ref to issue where warning was added

@marcofeltmann
Copy link

Is there any way to deactivate that warning in total?
I know that the rendering fails and I want it to show the square brackets instead of the ugly icons.

I totally understand the warning itself is a pretty good idea, but I'd love something like

require'obsidian'.setup({'conceallevelwarning' = 'skip'})

@marcofeltmann
Copy link

TBH but that might be a bug (in the plugin or in my brain)

If I have the following setup:

  1. conceallevel is 0 globally
  2. I have conceallevel = 2 locally for markdown files and opens Neovim with a buffer that is markdown

that warning appears directly after startup.

If I set conceallevel = 1 globally and conceallevel = 2 for markdown files there is no warning.

(Oh, yeah, commit e9a8fd0 it is on my machine, included via nvim pack, if that might be interesting)

Copy link
Owner

@epwalsh epwalsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @larrybotha, LGTM

@epwalsh
Copy link
Owner

epwalsh commented Jan 7, 2024

@marcofeltmann you can avoid the warning by disabling our additional syntax stuff. Does that work for you?

@epwalsh epwalsh merged commit 4c3f8c1 into epwalsh:main Jan 7, 2024
5 of 6 checks passed
@larrybotha larrybotha deleted the refactor/improve-ux-of-conceallevel-warning branch January 7, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants