highlightjs / highlightjs/highlight.js

(shell/bash) Wrong syntax highlight after a heredoc, until the end of the line.

Open
#4,377 0 comments 0 reactions 0 assignees View on GitHub
bug help welcome language
Dominant language
JavaScript
Stars
25k
Forks
3.8k
Avg merge
11h 35m
Merged PRs (30d)
3

Description

**Describe the issue**

hljs assumes that what comes after a heredoc is a string.

However, the end of the line may be the continuation of the command line.

**Which language seems to have the issue?**

shell, bash

**Are you using `highlight` or `highlightAuto`?**

highlight

**Sample Code to Reproduce**

```bash
echo "ok" <<-EOF | cat
Hello
EOF
```

**Expected behavior**

`cat` should be highlighted as a command instead of being highlighted as a string.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.