yoshuawuyts / vmd

:pray: preview markdown files
MIT License
1.18k stars 111 forks source link

Odd highlighting with HCL #121

Closed PicoSushi closed 6 years ago

PicoSushi commented 6 years ago

When I wrote markdown with contains HCL code and viewed with vmd, the highlighting was odd as below: vmd-ss2

As you can see, the first resource keyword didn't highlighted.

Markdown for reproduce is this:

First resource doesn't be highlighted!

resource "aws_instance" "example" {
  ami = "ami-40d28157"
  instance_type = "t2.micro"
}

resource "dnsimple_record" "example" {
  domain = "example.com"
  name   = "test"
  value  = "${aws_instance.example.public_ip}"
}

If comment line inserted, first resource also highlighted.

# blah blah blah
resource "aws_instance" "example" {
  ami = "ami-40d28157"
  instance_type = "t2.micro"
}

resource "dnsimple_record" "example" {
  domain = "example.com"
  name   = "test"
  value  = "${aws_instance.example.public_ip}"
}
maxkueng commented 6 years ago

Hi. Thanks for reporting the issue!

vmd uses highlight.js (indirectly via remark-highlight.js -> lowlight -> highlight.js).

The reported problem seems to be an issue in highlight.js. You can try to file an issue there. If it gets fixed and the dependencies in between get updated it will eventually land in vmd.

I'm going to close this as there isn't really anything I can do and the issue is not significant enough to switch to a different highlighting library.