Commit Graph
128 Commits
Author SHA1 Message Date
Douwe Maan 95f0440a78 Merge branch 'master' into rs-redactor-filter 2015-10-15 11:26:58 +02:00
Valery Sizov 8f584d5f2c Fix: Images cannot show when projects' path was changed 2015-10-14 18:50:35 +03:00
Douwe Maan 5dd77358f6 Pass project to RedactorFilter 2015-10-13 13:36:47 +02:00
Douwe Maan 4f629dab2a Merge branch 'master' into rs-redactor-filter 2015-10-07 15:15:35 +02:00
Stan Hu 8820785c8f Fix emoji URLs in Markdown when relative_url_root is used
Also adds the ability to run rspecs with relative_url_defined on the enviornment. For example:

RELATIVE_URL_ROOT=/gitlab rspec

Closes #1728
2015-09-06 09:46:10 -07:00
Robert Speicher 3b690891f3 Basic support for an Atom-specific rendering pipeline 2015-09-03 17:47:15 -04:00
Robert Speicher 5794d65a07 Add post_process method to Gitlab::Markdown 2015-09-01 18:16:56 -04:00
Robert Speicher 81fc63bec0 Remove current_user context from markdown and gfm helpers
These helpers are no longer dependent on the current user state. Hooray!
2015-09-01 17:59:09 -04:00
Robert Speicher 7f75300573 Add RedactorFilter 2015-09-01 17:00:29 -04:00
Robert Speicher 08ca941186 Move REDCARPET_OPTIONS to a private method
There wasn't really a reason to have them as a constant, and we were
getting "already defined" warnings which are always annoying.
2015-08-31 16:22:34 -04:00
Robert Speicher 8e7111f79d Reference filters no longer take a custom class context option 2015-08-27 15:36:26 -07:00
Robert Speicher 4340dd3eeb Decouple Gitlab::Markdown from the GitlabMarkdownHelper
This module is now the sole source of knowledge for *how* we render
Markdown (and GFM).
2015-08-27 14:17:26 -07:00
Robert Speicher 907860ed3d Remove the gfm_with_options helper
It was redundant because `gfm` also took options.
2015-08-12 23:32:16 -04:00
Kamil Trzcinski a34c61d9c6 Reuse HTML Pipeline object in Markdown parser
The patches reduces pressure on GC and reduces markdown processing time
2015-06-30 13:59:27 +02:00
Robert Speicher 023dd2907b Add a pipeline context option for SanitizationFilter
When this option is `:description`, we use a more restrictive whitelist.
This is used for Project and Group description fields.
2015-06-02 13:04:10 -04:00
Robert Speicher 7424d2fa5b Add ExternalLinkFilter to Markdown pipeline
Forces a `rel="nofollow"` attribute on all external links.
2015-05-27 15:39:08 -04:00
Robert Speicher 8ee382087d Subclass TaskList::Filter to fix a bug
Instead of using a fork, we subclass the filter and only apply the
`task-list` class to list items that actually are task lists.

Closes #1645

See https://github.com/github/task_list/pull/60
2015-05-20 12:08:33 -04:00
Dmitriy Zaporozhets 9c6f4a2351 Merge branch 'dashboard-references' into 'master'
Fix reference links in dashboard activity and ATOM feeds.

References like `@user` were not linked on the dashboard activity feed and in Atom feeds, because the reference parser depends on `@project` which isn't set in those situations.

This MR passes the project in question to the reference parsers in an option.

cc @rspeicher

See merge request !653
2015-05-15 09:59:26 +00:00
Douwe Maan cd52cef1c0 Fix reference links in dashboard activity and ATOM feeds. 2015-05-14 13:05:33 +02:00
Robert Speicher 7f2fb72a0a Minor RelativeLinkFilter cleanup 2015-05-13 14:08:37 -04:00
Jakub Jirutka b3276661f7 RelativeLinkFilter: refactor according to suggestions by @tsigo 2015-05-11 20:43:18 +02:00
Jakub Jirutka f7adac87fe Extract handling of relative file links to RelativeLinkFilter 2015-05-11 02:07:26 +02:00
Robert Speicher 6883e6e084 Remove all references to parse_tasks 2015-05-06 12:58:28 -04:00
Robert Speicher 61c73575c3 Add TaskList::Filter to pipeline 2015-05-06 12:58:27 -04:00
Robert Speicher 588267b5e2 Update the Gitlab::Markdown docs 2015-04-30 16:35:26 -04:00
Robert Speicher e46d1cdd8b Add Gitlab::Markdown::SanitizationFilter
This just extends the HTML::Pipeline::SanitizationFilter with our custom
whitelist.
2015-04-30 16:35:25 -04:00
Robert Speicher aa2cc670fe Add Gitlab::Markdown::AutolinkFilter 2015-04-30 16:35:25 -04:00
Robert Speicher 382a0aa6ef Add Gitlab::Markdown::TableOfContentsFilter
Removes header and table of contents processing from Redcarpet renderer.
2015-04-30 16:35:25 -04:00
Robert Speicher a14d109b9b Provide autoload paths for filters to prevent circular dependency 2015-04-23 12:58:55 -04:00
Robert Speicher fca624670a Update Gitlab::Markdown to use the 🆕 EmojiFilter
Removes emoji-centric tests from GFM specs 💥
2015-04-21 12:53:42 -04:00
Robert Speicher 34a23bda60 Add current_user to filter context 2015-04-20 13:01:43 -04:00
Robert Speicher 77a6746a75 Run SanitizationFilter before our reference filters 2015-04-20 13:01:42 -04:00
Robert Speicher 96c2b94048 Reference filters
Commit ranges, commits, external issues, issues, labels, merge requests,
snippets, users.
2015-04-20 13:01:42 -04:00
Dmitriy Zaporozhets bd97715a57 Merge branch 'fix-label-color' into 'master'
Parse GFM references after sanitizing

Parse GFM references - labels, issues, MRs, etc. - after calling the HTML Pipeline `SanitizationFilter` so that we can use non-whitelisted attributes like `style`.  See #2188.

See merge request !1745
2015-04-20 08:40:13 +00:00
Vinnie Okada df9a992c15 Fix GFM extractions
Extract and re-insert links after sanitizing user markup.
2015-04-17 20:39:38 -06:00
Dmitriy Zaporozhets ecb58dacd6 Merge branch 'reference-access-control' into 'master'
Only allow users to reference groups, projects, issues, MRs, commits they have access to.

Addresses https://dev.gitlab.org/gitlab/gitlabhq/issues/2183.

See merge request !1742
2015-04-13 14:10:25 +00:00
Douwe Maan 9d647197da Don't require user to every gfm call. 2015-04-03 18:03:01 +02:00
Douwe Maan c5d7660000 Fix errors. 2015-04-02 22:36:54 +02:00
Dmitriy Zaporozhets f8f9750323 Merge branch 'username-period' into 'master'
Don't allow username to end in period.

The current behavior doesn't do username referencing and mentioning in sentences like "I discussed with with @douwe." since `douwe.` is matched as a username.

Addresses private issue https://dev.gitlab.org/gitlab/gitlabhq/issues/2174.

See merge request !438
2015-04-02 20:28:23 +00:00
Douwe Maan ca58e369c9 Only allow user to reference objects they have access to. 2015-04-02 10:56:04 +02:00
Marin Jankovski d77f333f9c Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
Conflicts:
	lib/gitlab/markdown.rb
2015-03-31 19:03:54 -07:00
Dmitriy Zaporozhets dc3b4321ff Merge branch 'group-information-leak' into 'master'
Don't leak private group existence by redirecting from namespace controller to group controller.

See merge request !440
2015-04-01 01:01:38 +00:00
Vinnie Okada 9deda68257 Parse GFM references after sanitizing
Parse GFM references - labels, issues, MRs, etc. - after calling the
HTML Pipeline `SanitizationFilter` so that we can use non-whitelisted
attributes like `style`.
2015-03-28 08:58:30 -06:00
Douwe Maan 5f93b0e3da Don't allow username to end in period. 2015-03-27 11:10:56 +01:00
Douwe Maan e08d947e77 Use relative URL for Markdown references, except in mails. 2015-03-27 10:39:05 +01:00
Vinnie Okada 057c8c344b Merge branch 'master' into markdown-tags 2015-03-24 20:03:22 -06:00
Douwe Maan 61e8ca8ce0 Don't leak private group existence by redirecting from namespace controller to group controller. 2015-03-24 15:55:12 +01:00
Vinnie Okada a7afc06342 Fix SanitizationFilter bugs
Return a `SafeBuffer` instead of a `String` from the `#gfm_with_options`
method so that Rails doesn't escape our markup.

Also add `<span>` to the sanitization whitelist to avoid breaking syntax
highlighting in code blocks.
2015-03-22 20:17:56 -06:00
Vinnie Okada 1dc90fc455 Fix nested task lists
When nesting task list items, the parent item is wrapped in a `<p>` tag.
Update the task list parser to handle these paragraph wrappers.
2015-03-21 08:45:28 -06:00
Vinnie Okada cc29ce4917 Don't allow style attributes in inline HTML 2015-03-21 08:39:54 -06:00