Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML/HTML support #3

Closed
gitgrimbo opened this issue Apr 12, 2017 · 2 comments
Closed

XML/HTML support #3

gitgrimbo opened this issue Apr 12, 2017 · 2 comments

Comments

@gitgrimbo
Copy link

gitgrimbo commented Apr 12, 2017

When trying to highlight an XML file, the hljs HTML tags are output. Is this expected behaviour? Using the --language XML option does not change the output.

Command:

>highlight pom.xml

Result:

<span class="hljs-tag"><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"></span>
        <span class="hljs-tag"><modelVersion></span>4.0.0<span class="hljs-tag"></modelVersion></span>
        <span class="hljs-tag"><parent></span>
                <span class="hljs-tag"><groupId></span>org.springframework.boot<span class="hljs-tag"></groupId></span>
                <span class="hljs-tag"><artifactId></span>spring-boot-starter-parent<span class="hljs-tag"></artifactId></span>
                <span class="hljs-tag"><version></span>1.5.2.RELEASE<span class="hljs-tag"></version></span>
        <span class="hljs-tag"></parent></span>

cli-highlight-3

@felixfbecker
Copy link
Owner

I currently parse the HTML with a regexp, that only works for languages like SQL and JSON. XML and HTML have nested tags. See #1

It's not hard to do, there are countless HTML parsers on npm, I was just too lazy to implement it because I only needed SQL. Feel free to do a PR :)

@acarl005
Copy link

Check out my PR #5. It's not the best for performance, but it seems to work for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants