-
Notifications
You must be signed in to change notification settings - Fork 61
feature: ability to conceal meta information #397
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
Labels
enhancement
New feature or request
Comments
MeanderingProgrammer
added a commit
that referenced
this issue
Apr 15, 2025
## Details Request: #397 Adds new top level `document` configuration. The main part of this new configuration is a nested `conceal` configuration which contains two fields, `char_patterns` & `line_patterns`. These 2 fields will have their values iterated over the top level `markdown` document node text and any ranges that match the text will be concealed. The difference in behavior is the kind of mark that gets added over the range. - char_patterns: `conceal = ''` characters in the range are hidden but lines rest of line if any is still visible. - line_patterns: `conceal_lines = ''` entire lines are hidden even if match is partial, will unfold when user cursor enters the range, requires neovim `0.11.0` as that is when horizontal conceal was added. This plugin does not do anything clever for the ranges and will at no time support doing anything outside of the bounds of lua patterns. It is entirely up to the user to make good patterns, i.e. using `-` instead of `+/*` for non-greedy matches, capturing the start of line or start of document patterns, and any other specific behavior they want. Any issues opened about how to make a pattern do something or why does some pattern match like this will be auto-closed, lua patterns are well defined and easy to iterate and test with. Providing some examples below: - Hiding words surrounded by `:`, i.e. `:conceal-me:`: ```lua require('render-markdown').setup({ document = { conceal = { char_patterns = { ':%S-:%s' }, }, }, }) ``` - Hiding minus metadata ```lua require('render-markdown').setup({ document = { conceal = { line_patterns = { '^%-%-%-\n.-\n%-%-%-\n', -- start '\n%-%-%-\n.-\n%-%-%-\n', -- middle }, }, }, }) ``` - Hiding plus metadata ```lua require('render-markdown').setup({ document = { conceal = { line_patterns = { '^%+%+%+\n.-\n%+%+%+\n', -- start '\n%+%+%+\n.-\n%+%+%+\n', -- middle }, }, }, }) ```
Added here: 51da7d1 It's under the
require('render-markdown').setup({
document = {
conceal = {
char_patterns = { ':%S-:%s' },
},
},
})
require('render-markdown').setup({
document = {
conceal = {
line_patterns = {
'^%-%-%-\n.-\n%-%-%-\n', -- start
'\n%-%-%-\n.-\n%-%-%-\n', -- middle
},
},
},
})
require('render-markdown').setup({
document = {
conceal = {
line_patterns = {
'^%+%+%+\n.-\n%+%+%+\n', -- start
'\n%+%+%+\n.-\n%+%+%+\n', -- middle
},
},
},
}) Side note, if you add a lot of patterns it'll probably impact performance significantly on larger files. |
😗👌 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
It is useful to have meta information in md files to help search for text, but can quite ugly and expensive to look at.
Describe the solution you'd like
Id like the ability to conceal meta information like frontmatter and tags. e.g. text between two
---
at the start of a file or text between say two colons,:conceal-me:
.Thank you for such a great plugin!
Describe alternatives you've considered
I have had little luck with old school
syntax
commands. It would be lovely if there was a "conceal" or "metadata" module similar to eg headers, lists, that we could customize the behavoir of.Additional information
No response
The text was updated successfully, but these errors were encountered: