Commit graph

12 commits

Author SHA1 Message Date
Winnie Hellmann
9012d309f1 Increase Jest timeout to 500ms 2019-05-17 10:08:20 +00:00
Jan Beckmann
5848f2833a Escape special characters in GFM auto complete highlighting
Fixes #60552
2019-04-25 08:11:20 +00:00
Rajat Jain
b3f2f520c5 Move EE specific GfmAutocomplete code to EE file
Refactor GfmAutocomplete and create a new EE counterpart
which is referenced through `ee_else_ce`
2019-04-24 11:23:14 +05:30
Sean McGivern
67b16f7ea3 Only use backslash escapes in autocomplete when needed
Autocompletion for references happens on the frontend. Those references
are turned into actual references on the backend, but only after
Markdown processing has happened. That means that if a reference
contains a character that Markdown might consume, it won't render
correctly. So we need to do some escaping on the frontend.

We have these potential problem characters:
https://docs.gitlab.com/ee/user/markdown.html#emphasis

1. ~ - this is ~~strikethrough~~, but only when doubled.
2. _ - used for _emphasis_, doubled is __bold__.
3. * - also used for *emphasis*, doubled is **bold** also.
4. ` - used for `code spans`, any number works.

We don't need to escape `-` any more. When it comes to being inside a
word:

1. a~~b~~ has strikethrough, so it needs to be escaped everywhere.
2. a_b_ has no emphasis (see [a]) so it only needs to be escaped at the
   start and end of words.
3. a*b* has emphasis, so it needs to be escaped everywhere.
4. a`b` has a code span, so it needs to be escaped everywhere.

Or, in code terms:

1. Always escape ~~, *, and ` when being inserted by autocomplete.
2. Escape _ when it's either at the beginning or the end of a word.

[a]: https://docs.gitlab.com/ee/user/markdown.html#multiple-underscores-in-words
2019-04-17 13:15:36 +01:00
Kushal Pandya
5dc56f83b3 Merge branch 'winh-dequarantine-labels-autocomplete' into 'master'
Move gfm_autocomplete_spec.rb out of quarantine

Closes #57995 and #56843

See merge request gitlab-org/gitlab-ce!25958
2019-03-20 08:49:06 +00:00
Mike Greiling
7f3719f328 Prefer node_modules At.js and jquery.carat versions
Remove references to the vendored copies of At.js and jquery.carat
as well as the legacy rails wrapper gem.
2019-03-13 14:02:19 +00:00
Winnie Hellmann
af3307f7b4 Add getJSONFixture() helper to Jest 2019-03-11 14:55:18 +01:00
Winnie Hellmann
aeffdd2acd Increase timeout for gfm_auto_complete_spec.js 2019-03-11 11:30:19 +01:00
Phil Hughes
9ff9047402 Merge branch 'winh-dequarantine-labels-autocomplete' into 'master'
Move gfm_autocomplete_spec.rb out of quarantine

Closes #57995 and #56843

See merge request gitlab-org/gitlab-ce!25542

(cherry picked from commit 2dcbc0fa56)
2019-03-11 11:20:27 +01:00
Winnie Hellmann
55f76ce8f6 Revert "Merge branch 'winh-dequarantine-labels-autocomplete' into 'master'"
This reverts merge request !25542
2019-03-05 11:02:00 +00:00
Winnie Hellmann
f524dff3e9 Add tests for labels dropdown to gfm_auto_complete_spec.js 2019-02-27 09:08:41 +01:00
Winnie Hellmann
f3006b6a1e Move gfm_auto_complete_spec.js to Jest 2019-02-21 14:26:27 +01:00
Renamed from spec/javascripts/gfm_auto_complete_spec.js (Browse further)