From bb3de8fa5e509d5f5faf173fd1a92635a0023274 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Thu, 8 Oct 2020 00:40:28 +0200 Subject: Fix markdown and other highlighting, #578 --- syntax/html.vim | 497 +++++++++++++++++++++++++++----------------- syntax/html/aria.vim | 79 ------- syntax/html/electron.vim | 19 -- syntax/html/rdfa.vim | 15 -- syntax/javascript/html5.vim | 53 ----- 5 files changed, 312 insertions(+), 351 deletions(-) delete mode 100644 syntax/html/aria.vim delete mode 100644 syntax/html/electron.vim delete mode 100644 syntax/html/rdfa.vim delete mode 100644 syntax/javascript/html5.vim (limited to 'syntax') diff --git a/syntax/html.vim b/syntax/html.vim index 43db7575..a04b4c90 100644 --- a/syntax/html.vim +++ b/syntax/html.vim @@ -1,23 +1,15 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1 +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html') == -1 " Vim syntax file -" Language: HTML (version 5.1) -" SVG (SVG 1.1 Second Edition) -" MathML (MathML 3.0 Second Edition) -" Last Change: 2017 Mar 07 -" License: Public domain -" (but let me know if you like :) ) +" Language: HTML +" Maintainer: Jorge Maldonado Ventura +" Previous Maintainer: Claudio Fleiner +" Repository: https://notabug.org/jorgesumle/vim-html-syntax +" Last Change: 2020 Mar 17 +" Included patch from Florian Breisch to add the summary element " -" Note: This file just add new tags from HTML 5 -" and don't replace default html.vim syntax file -" -" Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com ) -" Changes: update to Draft 2016 Jan 13 -" add microdata Attributes -" Maintainer: Rodrigo Machado -" URL: http://rm.blog.br/vim/syntax/html.vim -" Modified: htdebeer -" Changes: add common SVG elements and attributes for inline SVG + +" Please check :help html.vim for some comments and a description of the options " quit when a syntax file was already loaded if !exists("main_syntax") @@ -30,178 +22,312 @@ endif let s:cpo_save = &cpo set cpo&vim -" Patch 7.4.1142 -if has("patch-7.4-1142") - if has("win32") - syn iskeyword @,48-57,_,128-167,224-235,- +syntax spell toplevel + +syn case ignore + +" mark illegal characters +syn match htmlError "[<>&]" + + +" tags +syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc +syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc +syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=javaScriptExpression,@htmlPreproc +syn region htmlEndTag start=++ contains=htmlTagN,htmlTagError +syn region htmlTag start=+<[^/]+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster +syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster +syn match htmlTagN contained +]<"ms=s+1 + + +" tag names +syn keyword htmlTagName contained address applet area a base basefont +syn keyword htmlTagName contained big blockquote br caption center +syn keyword htmlTagName contained cite code dd dfn dir div dl dt font +syn keyword htmlTagName contained form hr html img +syn keyword htmlTagName contained input isindex kbd li link map menu +syn keyword htmlTagName contained meta ol option param pre p samp span +syn keyword htmlTagName contained select small sub sup +syn keyword htmlTagName contained table td textarea th tr tt ul var xmp +syn match htmlTagName contained "\<\(b\|i\|u\|h[1-6]\|em\|strong\|head\|body\|title\)\>" + +" new html 4.0 tags +syn keyword htmlTagName contained abbr acronym bdo button col label +syn keyword htmlTagName contained colgroup fieldset iframe ins legend +syn keyword htmlTagName contained object optgroup q s tbody tfoot thead + +" new html 5 tags +syn keyword htmlTagName contained article aside audio bdi canvas data +syn keyword htmlTagName contained datalist details dialog embed figcaption +syn keyword htmlTagName contained figure footer header hgroup keygen main +syn keyword htmlTagName contained mark menuitem meter nav output picture +syn keyword htmlTagName contained progress rb rp rt rtc ruby section +syn keyword htmlTagName contained slot source summary template time track +syn keyword htmlTagName contained video wbr + +" legal arg names +syn keyword htmlArg contained action +syn keyword htmlArg contained align alink alt archive background bgcolor +syn keyword htmlArg contained border bordercolor cellpadding +syn keyword htmlArg contained cellspacing checked class clear code codebase color +syn keyword htmlArg contained cols colspan content coords enctype face +syn keyword htmlArg contained gutter height hspace id +syn keyword htmlArg contained link lowsrc marginheight +syn keyword htmlArg contained marginwidth maxlength method name prompt +syn keyword htmlArg contained rel rev rows rowspan scrolling selected shape +syn keyword htmlArg contained size src start target text type url +syn keyword htmlArg contained usemap ismap valign value vlink vspace width wrap +syn match htmlArg contained "\<\(http-equiv\|href\|title\)="me=e-1 + +" aria attributes +syn match htmlArg contained "\<\(aria-activedescendant\|aria-atomic\)\>" +syn match htmlArg contained "\<\(aria-autocomplete\|aria-busy\|aria-checked\)\>" +syn match htmlArg contained "\<\(aria-colcount\|aria-colindex\|aria-colspan\)\>" +syn match htmlArg contained "\<\(aria-controls\|aria-current\)\>" +syn match htmlArg contained "\<\(aria-describedby\|aria-details\)\>" +syn match htmlArg contained "\<\(aria-disabled\|aria-dropeffect\)\>" +syn match htmlArg contained "\<\(aria-errormessage\|aria-expanded\)\>" +syn match htmlArg contained "\<\(aria-flowto\|aria-grabbed\|aria-haspopup\)\>" +syn match htmlArg contained "\<\(aria-hidden\|aria-invalid\)\>" +syn match htmlArg contained "\<\(aria-keyshortcuts\|aria-label\)\>" +syn match htmlArg contained "\<\(aria-labelledby\|aria-level\|aria-live\)\>" +syn match htmlArg contained "\<\(aria-modal\|aria-multiline\)\>" +syn match htmlArg contained "\<\(aria-multiselectable\|aria-orientation\)\>" +syn match htmlArg contained "\<\(aria-owns\|aria-placeholder\|aria-posinset\)\>" +syn match htmlArg contained "\<\(aria-pressed\|aria-readonly\|aria-relevant\)\>" +syn match htmlArg contained "\<\(aria-required\|aria-roledescription\)\>" +syn match htmlArg contained "\<\(aria-rowcount\|aria-rowindex\|aria-rowspan\)\>" +syn match htmlArg contained "\<\(aria-selected\|aria-setsize\|aria-sort\)\>" +syn match htmlArg contained "\<\(aria-valuemax\|aria-valuemin\)\>" +syn match htmlArg contained "\<\(aria-valuenow\|aria-valuetext\)\>" +syn keyword htmlArg contained role + +" Netscape extensions +syn keyword htmlTagName contained frame noframes frameset nobr blink +syn keyword htmlTagName contained layer ilayer nolayer spacer +syn keyword htmlArg contained frameborder noresize pagex pagey above below +syn keyword htmlArg contained left top visibility clip id noshade +syn match htmlArg contained "\" + +" Microsoft extensions +syn keyword htmlTagName contained marquee + +" html 4.0 arg names +syn match htmlArg contained "\<\(accept-charset\|label\)\>" +syn keyword htmlArg contained abbr accept accesskey axis char charoff charset +syn keyword htmlArg contained cite classid codetype compact data datetime +syn keyword htmlArg contained declare defer dir disabled for frame +syn keyword htmlArg contained headers hreflang lang language longdesc +syn keyword htmlArg contained multiple nohref nowrap object profile readonly +syn keyword htmlArg contained rules scheme scope span standby style +syn keyword htmlArg contained summary tabindex valuetype version + +" html 5 arg names +syn keyword htmlArg contained allowfullscreen async autocomplete autofocus +syn keyword htmlArg contained autoplay challenge contenteditable contextmenu +syn keyword htmlArg contained controls crossorigin default dirname download +syn keyword htmlArg contained draggable dropzone form formaction formenctype +syn keyword htmlArg contained formmethod formnovalidate formtarget hidden +syn keyword htmlArg contained high icon inputmode keytype kind list loop low +syn keyword htmlArg contained max min minlength muted nonce novalidate open +syn keyword htmlArg contained optimum pattern placeholder poster preload +syn keyword htmlArg contained radiogroup required reversed sandbox spellcheck +syn keyword htmlArg contained sizes srcset srcdoc srclang step title translate +syn keyword htmlArg contained typemustmatch + +" special characters +syn match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,8};" + +" Comments (the real ones or the old netscape ones) +if exists("html_wrong_comments") + syn region htmlComment start=++ contains=htmlPreStmt,htmlPreError,htmlPreAttr +syn match htmlPreStmt contained "\)" + syn region htmlCssDefinition matchgroup=htmlArg start='style="' keepend matchgroup=htmlString end='"' contains=css.*Attr,css.*Prop,cssComment,cssLength,cssColor,cssURL,cssImportant,cssError,cssString,@htmlPreproc + hi def link htmlStyleArg htmlString +endif + +if main_syntax == "html" + " synchronizing (does not always work if a comment includes legal + " html tags, but doing it right would mean to always start + " at the first line, which is too slow) + syn sync match htmlHighlight groupthere NONE "<[/a-zA-Z]" + syn sync match htmlHighlight groupthere javaScript " 800 || v:version == 800 && has("patch1038") + hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough + else + hi def htmlStrike term=underline cterm=underline gui=underline + endif + endif +endif + +hi def link htmlPreStmt PreProc +hi def link htmlPreError Error +hi def link htmlPreProc PreProc +hi def link htmlPreAttr String +hi def link htmlPreProcAttrName PreProc +hi def link htmlPreProcAttrError Error +hi def link htmlSpecial Special +hi def link htmlSpecialChar Special +hi def link htmlString String +hi def link htmlStatement Statement +hi def link htmlComment Comment +hi def link htmlCommentPart Comment +hi def link htmlValue String +hi def link htmlCommentError htmlError +hi def link htmlTagError htmlError +hi def link htmlEvent javaScript +hi def link htmlError Error + +hi def link javaScript Special +hi def link javaScriptExpression javaScript +hi def link htmlCssStyleComment Comment +hi def link htmlCssDefinition Special let b:current_syntax = "html" @@ -211,5 +337,6 @@ endif let &cpo = s:cpo_save unlet s:cpo_save +" vim: ts=8 endif diff --git a/syntax/html/aria.vim b/syntax/html/aria.vim deleted file mode 100644 index 0c555e6e..00000000 --- a/syntax/html/aria.vim +++ /dev/null @@ -1,79 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1 - -" Vim syntax file -" Language: WAI-ARIA -" Maintainer: othree -" URL: https://github.com/othree/html5.vim -" Last Change: 2017-03-07 -" License: MIT -" Changes: update to Candidate Recommendation 27 October 2016 - -" WAI-ARIA States and Properties -" https://www.w3.org/TR/wai-aria-1.1/#states_and_properties -syn keyword htmlArg contained role - -" Global States and Properties -syn keyword htmlArg contained aria-atomic aria-busy aria-controls aria-describedby -syn keyword htmlArg contained aria-disabled aria-dropeffect aria-flowto aria-grabbed -syn keyword htmlArg contained aria-haspopup aria-hidden aria-invalid aria-label -syn keyword htmlArg contained aria-labelledby aria-live aria-owns aria-relevant -" 1.1 -syn keyword htmlArg contained aria-current aria-details aria-keyshortcuts aria-roledescription - -" Widget Attributes -syn keyword htmlArg contained aria-autocomplete aria-checked aria-disabled aria-expanded -syn keyword htmlArg contained aria-haspopup aria-hidden aria-invalid aria-label -syn keyword htmlArg contained aria-level aria-multiline aria-multiselectable aria-orientation -syn keyword htmlArg contained aria-pressed aria-readonly aria-required aria-selected -syn keyword htmlArg contained aria-sort aria-valuemax aria-valuemin aria-valuenow aria-valuetext -" 1.1 -syn keyword htmlArg contained aria-errormessage aria-hasgroup aria-modal aria-placeholder - -" Live Region Attributes -syn keyword htmlArg contained aria-atomic aria-busy aria-live aria-relevant - -" Drag-and-Drop attributes -syn keyword htmlArg contained aria-dropeffect aria-grabbed - -" Relationship Attributes -syn keyword htmlArg contained aria-activedescendant aria-controls aria-describedby aria-flowto -syn keyword htmlArg contained aria-labelledby aria-owns aria-posinset aria-setsize -" 1.1 -syn keyword htmlArg contained aria-colcount aria-colindex aria-colspan -syn keyword htmlArg contained aria-rowcount aria-rowindex aria-rowspan - - -" Use match: https://github.com/othree/html5.vim/issues/39 - -" Global States and Properties -syn match htmlArg contained "\" -syn match htmlArg contained "\" -syn match htmlArg contained "\" -syn match htmlArg contained "\" -" 1.1 -syn match htmlArg contained "\" - -" Widget Attributes -syn match htmlArg contained "\" -syn match htmlArg contained "\" -syn match htmlArg contained "\" -syn match htmlArg contained "\" -syn match htmlArg contained "\" -" 1.1 -syn match htmlArg contained "\" - -" Live Region Attributes -syn match htmlArg contained "\" - -" Drag-and-Drop attributes -syn match htmlArg contained "\" - -" Relationship Attributes -syn match htmlArg contained "\" -syn match htmlArg contained "\" -" 1.1 -syn match htmlArg contained "\" -syn match htmlArg contained "\" - - -endif diff --git a/syntax/html/electron.vim b/syntax/html/electron.vim deleted file mode 100644 index f51e1aef..00000000 --- a/syntax/html/electron.vim +++ /dev/null @@ -1,19 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1 - -" Vim syntax file -" Language: Electron -" Maintainer: othree -" URL: https://github.com/othree/html5.vim -" Last Change: 2017-03-15 -" License: MIT - -" https://electron.atom.io/docs/api/webview-tag/ -syn keyword htmlTagName contained webview - -syn keyword htmlArg contained autosize nodeintegration plugins preload httpreferrer -syn keyword htmlArg contained useragent disablewebsecurity partition allowpopups -syn keyword htmlArg contained webpreferences blinkfeatures disableblinkfeatures -syn keyword htmlArg contained guestinstance disableguestresize - - -endif diff --git a/syntax/html/rdfa.vim b/syntax/html/rdfa.vim deleted file mode 100644 index d772d43c..00000000 --- a/syntax/html/rdfa.vim +++ /dev/null @@ -1,15 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1 - -" Vim syntax file -" Language: RDFa -" Maintainer: othree -" URL: http://github.com/othree/html5-syntax.vim -" Last Change: 2012-06-08 -" License: MIT -" Changes: update to Rec 07 June 2012 - -" RDFa -" http://www.w3.org/TR/rdfa-syntax/#s_syntax -syn keyword htmlArg contained about content datatype href inlist prefix property rel resource rev src typeof vocab - -endif diff --git a/syntax/javascript/html5.vim b/syntax/javascript/html5.vim deleted file mode 100644 index 42ab78ad..00000000 --- a/syntax/javascript/html5.vim +++ /dev/null @@ -1,53 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1 - -" Vim syntax file -" Language: HTML5 New Stuff -" Maintainer: othree -" URL: http://github.com/othree/html5-syntax.vim -" Last Change: 2011-05-27 -" License: MIT -" Changes: - -syn keyword javascriptHtmlEvents onabort onblur oncanplay oncanplaythrough onchange -syn keyword javascriptHtmlEvents onclick oncontextmenu ondblclick ondrag ondragend ondragenter ondragleave ondragover -syn keyword javascriptHtmlEvents ondragstart ondrop ondurationchange onemptied onended onerror onfocus onformchange -syn keyword javascriptHtmlEvents onforminput oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata -syn keyword javascriptHtmlEvents onloadedmetadata onloadstart onmousedown onmousemove onmouseout onmouseover onmouseup -syn keyword javascriptHtmlEvents onmousewheel onpause onplay onplaying onprogress onratechange onreadystatechange -syn keyword javascriptHtmlEvents onscroll onseeked onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate -syn keyword javascriptHtmlEvents onvolumechange onwaiting - -" -syn keyword javascriptHtmlEvents onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload -syn keyword javascriptHtmlEvents onmessage onoffline ononline onpopstate onredo onresize onstorage onundo onunload - -" Media Controller -syn keyword javascriptDomElemAttrs buffered seekable duration currentTime paused -syn keyword javascriptDomElemAttrs played defaultPlaybackRate playbackRate volume muted -syn keyword javascriptDomElemAttrs mediaGroup -syn keyword javascriptDomElemFuncs load play pause - -syn keyword javascriptHtmlEvents oncanplay oncanplaythrough ondurationchange onemptied -syn keyword javascriptHtmlEvents onloadeddata onloadedmetadata onloadstart onpause onplay onplaying onratechange -syn keyword javascriptHtmlEvents ontimeupdate onvolumechange onwaiting - -"