gluegun icon indicating copy to clipboard operation
gluegun copied to clipboard

Highlight.js assigns markdown and ruby classes for yaml files

Open kaankabalak opened this issue 6 years ago • 0 comments

The auto detection feature of Highlight.js incorrectly highlights certain blocks of code, ideally we should have a way to pick up the argument from the lang attribute of the pre class and highlight accordingly if possible.

The following output is highlighted as a Makefile:

```yaml
apiVersion: v1  
kind: Pod
metadata: 
  name: prom-example
  labels:
    app: prom-example
spec:
  containers:
  - image: minio/minio
    name: minio
    args:
    - server
    - /tmp/minio
```

Here is the Gluegun output: screen shot 2018-11-30 at 3 27 54 pm

And the following is highlighted as a Ruby file:

```yaml
apiVersion: v1
kind: Pod
metadata: 
  name: prom-example
  labels:
    app: prom-example
  annotations:
    prometheus.io/scrape: 'true'    # turn on scraping first
    prometheus.io/path: '/minio/prometheus/metrics'  # the URL path of the endpoint that provides metrics
    prometheus.io/scheme: 'http'              # protocol scheme of the endpoint 
    prometheus.io/port: '9000'                # port of the endpoint
spec:
  containers:
  - image: minio/minio
    name: minio
    args:
    - server
    - /tmp/minio
```

Here is the Gluegun output: screen shot 2018-11-30 at 3 23 49 pm

Notice that both code blocks have the code <pre> tag with attribute lang="yaml and it should also be noted that the hljs classes are being created on the client side.

kaankabalak avatar Nov 30 '18 23:11 kaankabalak