summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/syntax/html.vim
AgeCommit message (Collapse)AuthorFiles
2025-05-11vim-patch:dc7ed8f: runtime(html): Optionally fold tags with the "expr" methodChristian Clason1
Tag folding poses a few difficulties. Many elements, e.g. "blockquote", are always delimited by start and end tags; end tags for some elements, e.g. "p", can be omitted in certain contexts; void elements, e.g. "hr", have no end tag. Although the rules for supporting omissible end tags are ad-hoc and involved, they apply to elements in scope. Assuming syntactical wellformedness, an end tag can be associated with its nearest matching start tag discoverable in scope and towards the beginning of a file, whereas all unbalanced tags and inlined tags can be disregarded. For example: ------------------------------------------------------------ <!DOCTYPE html> <html lang="en"> <!-- >1 : 1 --> <body> <!-- >2 : 2 --> <p>Paragraph vim/vim#1. <!-- = : 2 --> <p> <!-- >3 : 3 --> Paragraph vim/vim#2. <!-- = : 3 --> </p> <!-- <3 : 3 --> <p>Paragraph vim/vim#3.</p> <!-- = : 2 --> </body> <!-- <2 : 2 --> </html> <!-- <1 : 1 --> ------------------------------------------------------------ (HTML comments here, "<!-- ... -->", record two values for each folded line that are separated by ":", a value obtained from "&foldexpr" and a value obtained from "foldlevel()".) Innermost foldedable tags will be flattened. For example: ------------------------------------------------------------ <!DOCTYPE html> <html lang="en"> <!-- >1 : 1 --> <body> <!-- >2 : 2 --> <div class="block"> <!-- >3 : 3 --> <pre><code> <!-- >4 : 4 --> [CODE SNIPPET] <!-- = : 4 --> </code></pre> <!-- <4 : 4 --> </div> <!-- <3 : 3 --> </body> <!-- <2 : 2 --> </html> <!-- <1 : 1 --> ------------------------------------------------------------ No folding will be requested for the "<code>"-"</code>" tag pair and reflected by "&foldexpr" because such a fold would have claimed the same lines that the immediate fold of the "<pre>"-"</pre>" tag already claims. Run-on folded tags may confuse Vim. When a file such as: ------------------------------------------------------------ <!DOCTYPE html> <html lang="en"> <!-- >1 : 1 --> <body> <!-- >2 : 2 --> <div class="block"> <!-- >3 : 3 --> <pre> <!-- >4 : 4 --> <code> <!-- >5 : 5 --> [CODE SNIPPET vim/vim#1] <!-- = : 5 --> </code> <!-- <5 : 5 --> </pre> <!-- <4 : 4 --> </div> <!-- <3 : 3 --> <!-- = : 3 --> <div class="block"> <!-- >3 : 3 --> <pre> <!-- >4 : 4 --> <code> <!-- >5 : 5 --> [CODE SNIPPET vim/vim#2] <!-- = : 5 --> </code> <!-- <5 : 5 --> </pre> <!-- <4 : 4 --> </div> <!-- <3 : 3 --> </body> <!-- <2 : 2 --> </html> <!-- <1 : 1 --> ------------------------------------------------------------ is reformatted as follows: ------------------------------------------------------------ <!DOCTYPE html> <html lang="en"> <!-- >1 : 1 --> <body> <!-- >2 : 2 --> <div class="block"> <!-- >3 : 3 --> <pre> <!-- >4 : 4 --> <code> <!-- >5 : 5 --> [CODE SNIPPET vim/vim#1] <!-- = : 5 --> </code> <!-- <5 : 5 --> </pre> <!-- <4 : 4 --> </div><div class="block"><pre><code> <!-- <3 : 3 --> [CODE SNIPPET vim/vim#2] <!-- = : 2 ? --> </code> <!-- <5 : 2 ? --> </pre> <!-- <4 : 2 ? --> </div> <!-- <3 : 2 ? --> </body> <!-- <2 : 2 --> </html> <!-- <1 : 1 --> ------------------------------------------------------------ "&foldexpr" values will not be used as is for the lines between (and including) "[CODE SNIPPET vim/vim#2]" and "</div>". (Cf. v9.1.0002.) Having syntax highlighting in effect, tag folding using the "fold-expr" method can be enabled with: ------------------------------------------------------------ let g:html_expr_folding = 1 ------------------------------------------------------------ By default, tag folding will be redone from scratch after each occurrence of a TextChanged or an InsertLeave event. Such frequency may not be desired, especially for large files, and this recomputation can be disabled with: ------------------------------------------------------------ let g:html_expr_folding_without_recomputation = 1 doautocmd FileType ------------------------------------------------------------ To force another recomputation, do: ------------------------------------------------------------ unlet! b:foldsmap normal zx ------------------------------------------------------------ References: https://web.archive.org/web/20250328105626/https://html.spec.whatwg.org/multipage/syntax.html#optional-tags https://en.wikipedia.org/wiki/Dangling_else closes: vim/vim#17141 https://github.com/vim/vim/commit/dc7ed8f946a3109460435221ad45f92486c4ebca Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2024-07-31vim-patch:df9f67e: runtime(html): update syntax script to sync by 250 ↵Christian Clason1
minlines by default closes: vim/vim#14071 https://github.com/vim/vim/commit/df9f67e10d214e0124f2141f59593529801307a4 Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-06-16vim-patch:917ff8a: runtime(html): bump length of character references in ↵Christian Clason1
syntax script (vim/vim#15022) This allows handling longer references such as `&CounterClockwiseContourIntegral;`. https://github.com/vim/vim/commit/917ff8a19d2746dd922b7292dc61fb92e18b7ce2 Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
2023-11-29vim-patch:a9058440b7b9Christian Clason1
runtime(html): Update syntax file (vim/vim#13591) Add missing search element and update ARIA attribute list. Add a very basic test file to check all elements are matched. https://github.com/vim/vim/commit/a9058440b7b9d7f5d0027c8cd44366e9200ca241 Co-authored-by: dkearns <dougkearns@gmail.com>
2023-02-21vim-patch:partial:938ae280c79b (#22356)zeertzjq1
Update runtime files. https://github.com/vim/vim/commit/938ae280c79b8cdb0fca60336ec4c090ecd8bb5a Partially skip autocmd.txt: needs patch 8.2.5011. Partially skip builtin.txt: needs patch 9.0.0411. Partially skip eval.txt: needs patch 8.2.3783. Cherry-pick :map-meta-keys from patch 9.0.1276. Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-11-19vim-patch:partial:d13166e788fc (#21109)Sean Dewar1
Update runtime files https://github.com/vim/vim/commit/d13166e788fcaef59ec65c20b46ca4be16625669 - Skip E1309-1311 (not ported). - Skip `:echowindow` changes (not ported). - Skip termdebug winbar doc changes (not fully ported). - Port missing `g:termdebug_config.{wide,use_prompt}` changes from v8.2.5010. Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-07-26vim-patch:b529cfbd04c0 (#19501)Christian Clason1
Update runtime files https://github.com/vim/vim/commit/b529cfbd04c02e31cfa88f2c8d88b5ff532d4f7d
2021-05-02vim-patch:c8cdf0f80b3cJan Edmund Lazo1
Update runtime files. https://github.com/vim/vim/commit/c8cdf0f80b3cfd88a4490d80572062c1fd1a96ca
2021-05-02vim-patch:9faec4e3d439Jan Edmund Lazo1
Update runtime files. https://github.com/vim/vim/commit/9faec4e3d439968e21ad74e917aebb289df8f849 Omit vim9.
2021-04-27vim-patch:ff78155aa175Jan Edmund Lazo1
Update runtime files https://github.com/vim/vim/commit/ff78155aa1755aced96a3b343e81939c94aac721 Omit menu_info().
2021-04-27vim-patch:5666fcd0bd79Jan Edmund Lazo1
Update runtime files. https://github.com/vim/vim/commit/5666fcd0bd794dd46813824cce63a38bcae63794 Do not manually port E290 error message. Neovim has E5030,E5031 error messages to replace E290.
2019-08-01vim-patch:62e1bb4a111eJustin M. Keyes1
Update runtime files. https://github.com/vim/vim/commit/62e1bb4a111e7ce570c30965f40a68a07a9da5b0 NA: vim-patch:496555fd1821
2018-10-29vim-patch:d2f3a8b87873Justin M. Keyes1
Update runtime files. https://github.com/vim/vim/commit/d2f3a8b8787333abf2300d38836b196955f10c00
2018-10-28vim-patch:f0b03c4e98f8Justin M. Keyes1
Update runtime files https://github.com/vim/vim/commit/f0b03c4e98f8a7184d8b4a5d702cbcd602426923 Note: haskell changes were included in 942f3587c38a83cf6486a0b779765b54a1648493
2017-11-07vim-patch:01164a6546b4Justin M. Keyes1
Long overdue runtime update. https://github.com/vim/vim/commit/01164a6546b4c635daf96a1f17d1cb2d07f32a66
2017-05-01vim-patch:690afe1fef87Justin M. Keyes1
Update runtime files. https://github.com/vim/vim/commit/690afe1fef87e7eef6fb7343a926617d5f7315fa
2017-05-01vim-patch:68563937f58eJustin M. Keyes1
Updated runtime files. https://github.com/vim/vim/commit/68563937f58ea2dc31b58739336c383d2fd7e6cf
2017-05-01vim-patch:bc2eada5424bJustin M. Keyes1
Updated runtime files. https://github.com/vim/vim/commit/bc2eada5424bff06f7eb77c032ecc067da52b846 NA patches: vim-patch:294740d2ac42 vim-patch:a4ce25bd987a vim-patch:7034a8374345 vim-patch:14a612fa2e57 vim-patch:aaeabfbca571
2017-04-28vim-patch:f37506f60f87Justin M. Keyes1
Updated runtime files. Remove HiLink commands. https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
2017-04-28vim-patch:89bcfda6834aJustin M. Keyes1
Updated runtime files. Remove version checks for Vim older than 6.0. https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
2015-10-11vim-patch:8feef4f #3444rosston1
Update runtime files. https://github.com/vim/vim/commit/8feef4ff6253afb9dcc61c40082ed4fbb96b685c
2014-07-29re-integrate runtime/ vim-patch:0 #938Justin M. Keyes1
Vim runtime files based on 7.4.384 / hg changeset 7090d7f160f7 Excluding: Amiga icons (*.info, icons/) doc/hangulin.txt tutor/ spell/ lang/ (only used for menu translations) macros/maze/, macros/hanoi/, macros/life/, macros/urm/ These were used to test vi compatibility. termcap "Demonstration of a termcap file (for the Amiga and Archimedes)" Helped-by: Rich Wareham <rjw57@cam.ac.uk> Helped-by: John <john.schmidt.h@gmail.com> Helped-by: Yann <yann@yann-salaun.com> Helped-by: Christophe Badoit <c.badoit@lesiteimmo.com> Helped-by: drasill <github@tof2k.com> Helped-by: Tae Sandoval Murgan <taecilla@gmail.com> Helped-by: Lowe Thiderman <lowe.thiderman@gmail.com>