File: internal_links.vader

package info (click to toggle)
vim-link-vim 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 524 kB
  • sloc: python: 66; makefile: 30
file content (232 lines) | stat: -rw-r--r-- 8,013 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
Before:
  unlet! b:link_disable_internal_links
  unlet! g:link_disable_internal_links
After:
  unlet! b:link_disable_internal_links
  unlet! g:link_disable_internal_links

= 1 ============================================================================

Given markdown (Default settings):
  URL [foo](http://bar.com)
  Internal wiki page [alfa](bravo.md)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Execute:
  LinkConvertAll

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expect markdown:
  URL [foo][0]
  Internal wiki page [alfa][1]

  ## Links

  [0]: http://bar.com
  [1]: bravo.md
= 2 ============================================================================

Given markdown (Disabled globally):
  URL [foo](http://bar.com)
  Internal wiki page [alfa](bravo.md)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Execute:
  let g:link_disable_internal_links = 1
  LinkConvertAll

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expect markdown:
  URL [foo][0]
  Internal wiki page [alfa](bravo.md)

  ## Links

  [0]: http://bar.com
= 3 ============================================================================

Given markdown (Disabled buffer-local):
  URL [foo](http://bar.com)
  Internal wiki page [alfa](bravo.md)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Execute:
  let b:link_disable_internal_links = 1
  LinkConvertAll

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expect markdown:
  URL [foo][0]
  Internal wiki page [alfa](bravo.md)

  ## Links

  [0]: http://bar.com
= 4 ============================================================================

Given markdown (Enabled globally, disabled buffer-local):
  URL [foo](http://bar.com)
  Internal wiki page [alfa](bravo.md)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Execute:
  let g:link_disable_internal_links = 0
  let b:link_disable_internal_links = 1
  LinkConvertAll

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expect markdown:
  URL [foo][0]
  Internal wiki page [alfa](bravo.md)

  ## Links

  [0]: http://bar.com
= 5 ============================================================================

Given markdown (Disabled globally, enabled buffer-local):
  URL [foo](http://bar.com)
  Internal wiki page [alfa](bravo.md)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Execute:
  let g:link_disable_internal_links = 1
  let b:link_disable_internal_links = 0
  LinkConvertAll

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expect markdown:
  URL [foo][0]
  Internal wiki page [alfa][1]

  ## Links

  [0]: http://bar.com
  [1]: bravo.md
= 6 ============================================================================

Given markdown (Default (so enabled); list of URLs and internal wiki pages):
  A regular [URL](https://github.com).
  A URL without a protocol but including 'www' or [world wide web](www.google.com)!
  Not a Markdown extension but a Moldovan [domain](https://nic.md).
  A .wiki top-level [domain name](https://kodi.wiki/view/Main_Page).

  A link to an internal wiki page; in this case a regular [file](file.md).
  A file inside a [subdirectory](subdir/file.md).
  A file in a [parent](../file.md) directory.
  Just a [directory](subdir/), no filename.
  A filename containing [spaces](file with spaces.md).
  The same filename but this time [percent-encoded](file%20with%20spaces.md).
  A filename containing [Unicode](önskelistä.md) characters.
  An anchor, pointing to a heading inside a [file](file.md#heading).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Execute:
  LinkConvertAll

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expect markdown:
  A regular [URL][0].
  A URL without a protocol but including 'www' or [world wide web][1]!
  Not a Markdown extension but a Moldovan [domain][2].
  A .wiki top-level [domain name][3].

  A link to an internal wiki page; in this case a regular [file][4].
  A file inside a [subdirectory][5].
  A file in a [parent][6] directory.
  Just a [directory][7], no filename.
  A filename containing [spaces][8].
  The same filename but this time [percent-encoded][9].
  A filename containing [Unicode][10] characters.
  An anchor, pointing to a heading inside a [file][11].

  ## Links

  [0]: https://github.com
  [1]: www.google.com
  [2]: https://nic.md
  [3]: https://kodi.wiki/view/Main_Page
  [4]: file.md
  [5]: subdir/file.md
  [6]: ../file.md
  [7]: subdir/
  [8]: file with spaces.md
  [9]: file%20with%20spaces.md
  [10]: önskelistä.md
  [11]: file.md#heading
= 7 ============================================================================

Given markdown (Disabled; list of URLs and internal wiki pages):
  A regular [URL](https://github.com).
  A URL without a protocol but including 'www' or [world wide web](www.google.com)!
  Not a Markdown extension but a Moldovan [domain](https://nic.md).
  A .wiki top-level [domain name](https://kodi.wiki/view/Main_Page).

  A link to an internal wiki page; in this case a regular [file](file.md).
  A file inside a [subdirectory](subdir/file.md).
  A file in a [parent](../file.md) directory.
  Just a [directory](subdir/), no filename.
  A filename containing [spaces](file with spaces.md).
  The same filename but this time [percent-encoded](file%20with%20spaces.md).
  A filename containing [Unicode](önskelistä.md) characters.
  An anchor, pointing to a heading inside a [file](file.md#heading).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Execute:
  let g:link_disable_internal_links = 1
  LinkConvertAll

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expect markdown:
  A regular [URL][0].
  A URL without a protocol but including 'www' or [world wide web](www.google.com)!
  Not a Markdown extension but a Moldovan [domain][1].
  A .wiki top-level [domain name][2].

  A link to an internal wiki page; in this case a regular [file](file.md).
  A file inside a [subdirectory](subdir/file.md).
  A file in a [parent](../file.md) directory.
  Just a [directory](subdir/), no filename.
  A filename containing [spaces](file with spaces.md).
  The same filename but this time [percent-encoded](file%20with%20spaces.md).
  A filename containing [Unicode](önskelistä.md) characters.
  An anchor, pointing to a heading inside a [file](file.md#heading).

  ## Links

  [0]: https://github.com
  [1]: https://nic.md
  [2]: https://kodi.wiki/view/Main_Page
= 8 ============================================================================

Given markdown (Similar to inline links; causes issues if internal links aren't disabled):
  A regular [URL](https://github.com).
  A regex like [a-zA-Z](\d+) could be interpreted as a Markdown inline link.
  Code snippets can resemble an inline link too: command! -buffer -range=% -bar TagLinks silent keeppatterns <line1>,<line2>substitute#\v%(\[[^\]]+\]\(\s*)@https?://([^.]+)\S+#[\1](\0)#giep
  Yet another regular [URL](https://www.vim.org).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Execute:
  let g:link_disable_internal_links = 1
  LinkConvertAll

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expect markdown:
  A regular [URL][0].
  A regex like [a-zA-Z](\d+) could be interpreted as a Markdown inline link.
  Code snippets can resemble an inline link too: command! -buffer -range=% -bar TagLinks silent keeppatterns <line1>,<line2>substitute#\v%(\[[^\]]+\]\(\s*)@https?://([^.]+)\S+#[\1](\0)#giep
  Yet another regular [URL][1].

  ## Links

  [0]: https://github.com
  [1]: https://www.vim.org
================================================================================