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

(yaml) add support for dates/timestamps #2475

Closed
tamlyn opened this issue Mar 30, 2020 · 1 comment · Fixed by #2496
Closed

(yaml) add support for dates/timestamps #2475

tamlyn opened this issue Mar 30, 2020 · 1 comment · Fixed by #2496
Labels
bug good first issue Should be easier for first time contributors help welcome Could use help from community language

Comments

@tamlyn
Copy link

tamlyn commented Mar 30, 2020

Describe the issue
Highlighting of YAML date/datetime objects is inconsistent.

Screen Shot 2020-03-30 at 12 31 59

Some things that are parsed by YAML as dates get highlighted partly as strings, some things that are parsed by YAML as strings get highlighted as dates (or maybe numbers).

Which language seems to have the issue?
yaml

Are you using highlight or highlightAuto?
initHighlightingOnLoad with a language classname (see codepen below).

Sample Code to Reproduce
https://codepen.io/tamlyn/pen/mdJvMYv

Expected behavior
I expect the highlighting to be consistent with YAML's complex datatype parsing. But given the highlighting rules are based on regexes, maybe I expect too much.

@tamlyn tamlyn added bug help welcome Could use help from community language labels Mar 30, 2020
@joshgoebel
Copy link
Member

joshgoebel commented Mar 30, 2020

Reference: https://yaml.org/type/timestamp.html

Looks like we'd be able to do this, but currently we don't have any special recognition for dates at all. What you're seeing is the number rule in action.

PR would be welcome (with tests). I'd expect it to cover the examples in the link provided.

@joshgoebel joshgoebel added the good first issue Should be easier for first time contributors label Mar 30, 2020
@joshgoebel joshgoebel changed the title YAML dates are not highlighted correctly (yaml) dates are not highlighted Mar 30, 2020
@joshgoebel joshgoebel changed the title (yaml) dates are not highlighted (yaml) add support for dates/timestamps Mar 30, 2020
pplantinga added a commit to pplantinga/highlight.js that referenced this issue Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Should be easier for first time contributors help welcome Could use help from community language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants