메모장 ++ 잘못된 구문 강조? <title>Page</title>

그래서 XHTML 1.0 Strict 기반 웹 사이트를 만들고 싶습니다. 구문 강조에 메모장 ++을 사용하면 나에게 아이디어가되었습니다. 그러나 XML 선언을 넣으려고 할 때 (사양에 명시된 바와 같이 적절한 XHTML 페이지는 XML 선언을 사용해야하고 application / xhtml + xml로 제공되어야 함) 전체 문서를 올바르게 강조 표시 할 수 없습니다. 기본 페이지에 사용한 코드는 다음과 같습니다.

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
    <head>
        <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
        <title>Page</title>
        <script type="application/javascript">
                alert("A perfectly valid xHTML page...");
        </script>
        <style type="text/css">
                #test {
                    text-align: center;
                }
        </style>
    </head>
    <body>
        <h1 id="test">TEST</h1>
    </body>
</html>

이것을 메모장 ++에 붙여 넣으면 언어가 XML로 설정된 경우 코드 <script type="application/javascript">와 코드 사이를 강조 표시하지 않습니다 </script>(배경을 흰색으로 렌더링 함). 언어를 HTML로 설정하면 스크립트가 올바르게 강조 표시되지만 XML 선언은 강조 표시되지 않습니다. 무엇을해야합니까? 하이브리드 언어를 만드는 방법-XML과 HTML의 조합?



답변

Notepad ++는 파일의 확장자를 사용하여 사용할 Lexer (즉, 형광펜)를 결정합니다. 파일을 .xhtml로 저장하면 제대로 강조 표시됩니다. 실제로 파일은 동일한 Lexer를 사용하므로 파일을 .html로 저장할 수 있습니다.

Notepad ++ 파일 langs.model.xml을 보면 무슨 의미인지 알 수 있습니다.

<Language name="html" ext="html htm shtml shtm xhtml hta" commentLine="" commentStart="&lt;!--" commentEnd="--&gt;">
    <Keywords name="instre1">!doctype a abbr accept accept-charset accesskey acronym action address align alink alt applet archive area article aside audio axis b background base basefont bdo bgcolor big blockquote body border br button canvas caption cellpadding cellspacing center char charoff charset checkbox checked cite class classid clear code codebase codetype col colgroup color cols colspan command  compact content contenteditable contextmenu coords data datafld dataformatas datalist datapagesize datasrc datetime dd declare defer del details dfn dir disabled div dl draggable dropzone dt em embed enctype event face fieldset figcaption figure file font footer for form frame frameborder frameset h1 h2 h3 h4 h5 h6 head header  height hgroup hidden hr href hreflang hspace html http-equiv i id iframe image img input ins isindex ismap kbd keygen label lang language leftmargin legend li link  longdesc map marginheight marginwidth mark marquee maxlength media menu meta meter method multiple name nav noframes nohref noresize noscript noshade nowrap object ol onabort onafterprint onbeforeonload onbeforeprint onblur oncanplay oncanplaythrough onchange onclick oncontextmenu ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange ondurationchange onemptied onended onerror onfocus onformchange onforminput onhaschange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart onmessage onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onoffline ononline onpagehide onpageshow onpause onplay onplaying onpopstate onprogress onratechange onreadystatechange onredo onreset onresize onscroll onseeked onseeking onselect onselect onstalled onstorage onsubmit onsubmit onsuspend ontimeupdate onundo onunload onunload onvolumechange onwaiting optgroup option output p param password placeholder pre profile progress prompt public q radio readonly rel reset rev rows rowspan rp rt ruby rules s samp scheme scope script  section select selected shape size small source span spellcheck src standby start strike strong style sub submit summary sup tabindex table target tbody td text textarea tfoot th thead time title topmargin tr tt type u ul usemap valign value valuetype var version video vlink vspace wbr width xml xmlns</Keywords>
</Language>


답변