highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

Improve Gherkin support

Open Hirse opened this issue 2 years ago • 6 comments

Resolves #3638 Resolves #3639

image

Changes

  • Move keywords to mode to support keywords with spaces and those ending with a colon
  • Update list of keywords (see below)
  • Change * from symbol to keyword since that is how it's described in the reference
  • Tighten variable definition to disallow whitespace
  • Only recognize keywords, comments, tags, and docstrings at the beginning of a line
  • Support docstrings starting with triple backticks
  • Remove (non-docstring) string mode

Reference

  • https://cucumber.io/docs/gherkin/reference image
  • https://cucumber.io/docs/gherkin/languages/#gherkin-dialect-en-content image

Checklist

  • [X] Added markup tests
  • [X] Updated the changelog at CHANGES.md

Hirse avatar Oct 22 '22 19:10 Hirse

thanks very much

pkufranky avatar Oct 24 '22 09:10 pkufranky

Technically all features (except variables) are only valid at the beginning of a line.

Can't we do this with multi-match and ^ (start line)? Just use the first part of the match to grab the whitespace...

joshgoebel avatar Oct 25 '22 04:10 joshgoebel

and those ending with a colon

Is the colon part of the keyword though?

joshgoebel avatar Oct 25 '22 04:10 joshgoebel

Updated with a new version that removes the custom keyword pattern and fixes false positives.

I couldn't figure out a good way to match for "beginning of line, skipping the whitespace" as /^[ \t]*/ triggers the "zero-width regex" error so there's currently a bunch of duplication.

Hirse avatar Oct 27 '22 06:10 Hirse

Any progress for this pr?

pkufranky avatar Dec 01 '22 15:12 pkufranky

@Hirse is this ready to go? sorry for long wait. coud you update changes.md?

joshgoebel avatar Jul 07 '24 04:07 joshgoebel