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 timestamps #2496

Merged
merged 2 commits into from Apr 17, 2020

Conversation

pplantinga
Copy link
Contributor

@pplantinga pplantinga commented Apr 17, 2020

Add support for timestamps to YAML. Closes #2475.

@@ -44,6 +44,15 @@ export default function(hljs) {
]
};

var DATE_RE = '[0-9]{4}(-[0-9][0-9]){0,2}';
var TIME_RE = '([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?';
var FRAC_RE = '(\\.[0-9]*)?';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please no abbreviations.

var ZONE_RE = '([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?';
var TIMESTAMP = {
className: 'number',
begin: DATE_RE + TIME_RE + FRAC_RE + ZONE_RE + '\\b',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only a boundary at the end and not the beginning?

@joshgoebel
Copy link
Member

Only those two notes, otherwise this looks great. Told ya it'd be easier. :)

@joshgoebel joshgoebel changed the title YAML add support for timestamps #2475 (yaml) add support for timestamps Apr 17, 2020
@joshgoebel joshgoebel merged commit c7c561d into highlightjs:master Apr 17, 2020
@pplantinga pplantinga deleted the fix-yaml-dates branch April 17, 2020 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(yaml) add support for dates/timestamps
2 participants