Skip to content

Commit 76e7e74

Browse files
committed
Updated README
1 parent 3451470 commit 76e7e74

File tree

4 files changed

+72
-23
lines changed

4 files changed

+72
-23
lines changed

README.md

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
This plugin adds some spice to the bundled [vim-markdown][3], such as:
44

5-
- Easy toggle italic, bold, strike-through, code delimiters,
5+
- Easy toggle italic, bold, strike-through, code text-styles,
66
- Easy to add/jump/remove/preview links,
77
- Toggle quoted and code blocks,
88
- Format with `gq` and on save,
99
- Render with `pandoc`,
10-
- Easy configuration and usage
1110
- ... and more.
1211

1312
# Requirements
@@ -20,17 +19,19 @@ lines:
2019
filetype indent plugin on
2120
syntax on
2221
```
23-
To enable the rendering feature, you need to install [pandoc][1].
24-
To automatically open the rendered files, Vim must have the `:Open` command.
2522

26-
To enable the formatting feature, you need to install [prettier][2] or any other
27-
formatting program of your choice.
23+
The following is not mandatory, but you want to enable the rendering feature,
24+
you need to install [pandoc][1]. To automatically open the rendered files, Vim
25+
must have the `:Open` command.
26+
27+
Along the same line, to enable the formatting feature, you need to install
28+
[prettier][2] or any other formatting program of your choice.
2829

2930
# Usage
3031

3132
To best way to describe how to operate it, let's go through some examples.
3233

33-
## Text-styles
34+
### Text-styles
3435

3536
Open a markdown file and place the cursor on a word.
3637
Hit `<localleader>biw` to change the text-style inside-the-word
@@ -46,7 +47,7 @@ not persistent. As usual, you can remove the highlight with `<localleader>d`.
4647

4748
See `markdown-extras-mappings` for all the possible text styles.
4849

49-
## Links
50+
### Links
5051

5152
Now, place the cursor on a word and hit `<enter>`.
5253
Select `Create new link` from the popup menu and point to an existing
@@ -76,14 +77,14 @@ comment line.
7677
>
7778
> The links management only applies to links reported after the
7879
> `<!-- DO NOT REMOVE vim-markdown-extras references DO NOT REMOVE-->`
79-
> comment line.
80+
> comment line. Such a line shall be unique in the buffer.
8081
81-
## Lists
82+
### Lists
8283

8384
You can create lists or enumerations as usual. However, the behavior of the
8485
`<enter>` key is hacked to mimic the behavior of Microsoft products and
8586
respect possible nesting. Although there are many reasons to stick with the
86-
bundled `ft-markdown-plugin` behavior when it comes to lists,
87+
bundled [vim-markdown][3] behavior when it comes to lists,
8788
my use-cases and preferences require a different behavior. At the end Vim is a
8889
matter of customizing everything to your workflow, no? :)
8990

@@ -96,7 +97,7 @@ to-do list with `<localleader>x`.
9697
> If you have `vim-outline` installed, then you can use `<localleader>o` to
9798
> display the unchecked items of the to-do list in a scratch buffer.
9899
99-
## Formatting
100+
### Formatting
100101

101102
You can format text as usual by using `gq`.
102103
Here `gq` uses `prettier`, provided that you have it installed.
@@ -105,7 +106,7 @@ then hit `gq`, then `prettier` will only prettify such a portion of text. You
105106
can also prettify the whole buffer on save, see `markdown-extras-config` how
106107
to do that.
107108

108-
## Rendering
109+
### Rendering
109110

110111
You can then use `:make` to render your buffer with `pandoc`, provided that
111112
you have `pandoc` installed.
@@ -129,7 +130,7 @@ You could for example set the following:
129130
>
130131
> The rendered file will automatically open if your Vim has the `:Open` command.
131132
132-
## Indices
133+
### Indices
133134

134135
As the plugin can be used for note-taking, it may be desirable to access
135136
different indices in an ergonomic way. This can be achieved with the
@@ -139,7 +140,30 @@ command.
139140
For more information about key-bindings, configuration, etc. take
140141
a look at `:h markdown-extras`.
141142

142-
## License
143+
### Limitations
144+
145+
Nothing is perfect, and this plugin is no exception. Here are some random
146+
limitations:
147+
148+
- Markdown is not a regular language, and many features rely on regular
149+
expressions. This means there will always be corner cases where some features
150+
fail. Parsing non-regular languages requires more advanced tools like
151+
Tree-sitter. However, it is generally not a good idea to "punish" all use
152+
cases with slow and memory-hungry solutions just for a few edge cases that
153+
likely occur very sporadically. I prefer efficiency and speed for most use
154+
cases, and for the others... well, patience!
155+
156+
- The plugin somewhat forces the use of reference-style links where the
157+
reference identifier is a number. You could try using strings as reference
158+
identifiers, but I won't guarantee that everything will work fine.
159+
160+
- The link management system heavily relies on the content below the
161+
"<!-- DO NOT REMOVE vim-markdown-extras references DO NOT REMOVE -->"
162+
comment. That comment must be unique. Attempting to pick links randomly
163+
scattered throughout the buffer using regular expressions would most likely
164+
lead to the issue described in the first bullet point.
165+
166+
### License
143167

144168
BSD-3.
145169

doc/markdown_extras.txt

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,22 @@ CONTENTS *markdown-extras-contents*
1212
4. Commands ............. |markdown-extras-commands|
1313
5. Mappings ............. |markdown-extras-mappings|
1414
6. Configuration ........ |markdown-extras-configuration|
15-
7. License .............. |markdown-extras-license|
15+
7. Limitations .......... |markdown-extras-limitations|
16+
8. License .............. |markdown-extras-license|
1617

1718

1819
==============================================================================
1920
INTRODUCTION *markdown-extras-introduction*
2021

2122
This plugin adds some spice to the bundled |ft-markdown-plugin|, such as:
2223

23-
- Easy toggle italic, bold, strike-through, code delimiters,
24+
- Easy toggle italic, bold, strike-through, code text-styles,
2425
- Easy to add/jump/remove/preview links,
2526
- Toggle quoted and code blocks,
2627
- Format with |gq| and on save,
2728
- Render with `pandoc`,
28-
- Easy configuration and usage
2929
- ... and more.
3030

31-
3231
==============================================================================
3332
REQUIREMENTS *markdown-extras-requirements*
3433

@@ -253,6 +252,31 @@ selection bold.
253252
<Plug>MarkdownQuoteBlock Set quote-block.
254253
Default: `<localleader>q{motion}`
255254

255+
256+
==============================================================================
257+
LIMITATIONS *markdown-extras-limitations*
258+
259+
Nothing is perfect, and this plugin is no exception. Here are some random
260+
limitations:
261+
262+
- Markdown is not a regular language, and many features rely on regular
263+
expressions. This means there will always be corner cases where some features
264+
fail. Parsing non-regular languages requires more advanced tools like
265+
Tree-sitter. However, it is generally not a good idea to "punish" all use
266+
cases with slow and memory-hungry solutions just for a few edge cases that
267+
likely occur very sporadically. I prefer efficiency and speed for most use
268+
cases, and for the others... well, patience!
269+
270+
- The plugin somewhat forces the use of reference-style links where the
271+
reference identifier is a number. You could try using strings as reference
272+
identifiers, but I won't guarantee that everything will work fine.
273+
274+
- The link management system heavily relies on the content below the
275+
"<!-- DO NOT REMOVE vim-markdown-extras references DO NOT REMOVE -->"
276+
comment. That comment must be unique. Attempting to pick links randomly
277+
scattered throughout the buffer using regular expressions would most likely
278+
lead to the issue described in the first bullet point.
279+
256280
==============================================================================
257281
LICENSE *markdown-extras-license*
258282

doc/tags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ markdown-extras-configuration markdown_extras.txt /*markdown-extras-configuratio
99
markdown-extras-contents markdown_extras.txt /*markdown-extras-contents*
1010
markdown-extras-introduction markdown_extras.txt /*markdown-extras-introduction*
1111
markdown-extras-license markdown_extras.txt /*markdown-extras-license*
12+
markdown-extras-limitations markdown_extras.txt /*markdown-extras-limitations*
1213
markdown-extras-mappings markdown_extras.txt /*markdown-extras-mappings*
1314
markdown-extras-requirements markdown_extras.txt /*markdown-extras-requirements*
1415
markdown-extras-usage markdown_extras.txt /*markdown-extras-usage*

lib/links.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export def RefreshLinksDict(): dict<string>
6060
#
6161
# Cleanup the current b:markdown_extras_links
6262
var links_dict = {}
63-
const references_line = search(references_comment, 'nw')
63+
const references_line = search($'^{references_comment}', 'nw')
6464
if references_line != 0
6565
for l in range(references_line + 1, line('$'))
6666
var ref = getline(l)
@@ -109,7 +109,7 @@ def GetLinkID(): number
109109
if !IsURL(link)
110110
link = fnamemodify(link, ':p')
111111
endif
112-
var reference_line = search(references_comment, 'nw')
112+
var reference_line = search($'^{references_comment}', 'nw')
113113
if reference_line == 0
114114
append(line('$'), ['', references_comment])
115115
endif
@@ -212,7 +212,7 @@ export def OpenLink()
212212
enddef
213213

214214
export def ConvertLinks()
215-
const references_line = search(references_comment, 'nw')
215+
const references_line = search($'^{references_comment}', 'nw')
216216
if references_line == 0
217217
append(line('$'), ['', references_comment])
218218
endif
@@ -450,7 +450,7 @@ enddef
450450

451451
export def CreateLink(type: string = '')
452452
InitScriptLocalVars()
453-
const references_line = search(references_comment, 'nw')
453+
const references_line = search($'^{references_comment}', 'nw')
454454
if references_line == 0
455455
append(line('$'), ['', references_comment])
456456
endif

0 commit comments

Comments
 (0)