summaryrefslogtreecommitdiff
path: root/lib/gitlab/markdown.rb
Commit message (Collapse)AuthorAgeFilesLines
* Move REDCARPET_OPTIONS to a private methodRobert Speicher2015-08-311-14/+16
| | | | | There wasn't really a reason to have them as a constant, and we were getting "already defined" warnings which are always annoying.
* Reference filters no longer take a custom class context optionRobert Speicher2015-08-271-1/+0
|
* Decouple Gitlab::Markdown from the GitlabMarkdownHelperRobert Speicher2015-08-271-8/+54
| | | | | This module is now the sole source of knowledge for *how* we render Markdown (and GFM).
* Remove the `gfm_with_options` helperrs-remove-gfm_with_optionsRobert Speicher2015-08-121-11/+1
| | | | It was redundant because `gfm` also took options.
* Reuse HTML Pipeline object in Markdown parserKamil Trzcinski2015-06-301-2/+2
| | | | The patches reduces pressure on GC and reduces markdown processing time
* Add a `pipeline` context option for SanitizationFilterRobert Speicher2015-06-021-0/+3
| | | | | When this option is `:description`, we use a more restrictive whitelist. This is used for Project and Group description fields.
* Add ExternalLinkFilter to Markdown pipeliners-dont-follow-meRobert Speicher2015-05-271-0/+2
| | | | Forces a `rel="nofollow"` attribute on all external links.
* Subclass TaskList::Filter to fix a bugrs-issue-1645Robert Speicher2015-05-201-2/+2
| | | | | | | | | 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
* Merge branch 'dashboard-references' into 'master'Dmitriy Zaporozhets2015-05-151-7/+9
|\ | | | | | | | | | | | | | | | | | | | | | | 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
| * Fix reference links in dashboard activity and ATOM feeds.dashboard-referencesDouwe Maan2015-05-141-7/+9
| |
* | Minor RelativeLinkFilter cleanuprs-relative-link-filterRobert Speicher2015-05-131-2/+2
|/
* RelativeLinkFilter: refactor according to suggestions by @tsigoJakub Jirutka2015-05-111-1/+0
|
* Extract handling of relative file links to RelativeLinkFilterJakub Jirutka2015-05-111-1/+9
|
* Remove all references to `parse_tasks`Robert Speicher2015-05-061-28/+3
|
* Add TaskList::Filter to pipelineRobert Speicher2015-05-061-4/+7
|
* Update the Gitlab::Markdown docsRobert Speicher2015-04-301-25/+1
|
* Add Gitlab::Markdown::SanitizationFilterRobert Speicher2015-04-301-31/+3
| | | | | This just extends the HTML::Pipeline::SanitizationFilter with our custom whitelist.
* Add Gitlab::Markdown::AutolinkFilterRobert Speicher2015-04-301-1/+3
|
* Add Gitlab::Markdown::TableOfContentsFilterRobert Speicher2015-04-301-0/+5
| | | | Removes header and table of contents processing from Redcarpet renderer.
* Provide autoload paths for filters to prevent circular dependencyRobert Speicher2015-04-231-3/+14
|
* Update Gitlab::Markdown to use the :new: EmojiFilter :sparkles:Robert Speicher2015-04-211-12/+16
| | | | Removes emoji-centric tests from GFM specs :boom:
* Add current_user to filter contextRobert Speicher2015-04-201-0/+1
|
* Run SanitizationFilter before our reference filtersRobert Speicher2015-04-201-2/+7
|
* Reference filters :sparkles:Robert Speicher2015-04-201-283/+41
| | | | | Commit ranges, commits, external issues, issues, labels, merge requests, snippets, users.
* Merge branch 'fix-label-color' into 'master'Dmitriy Zaporozhets2015-04-201-16/+16
|\ | | | | | | | | | | | | | | 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
| * Fix GFM extractionsVinnie Okada2015-04-171-13/+13
| | | | | | | | Extract and re-insert links after sanitizing user markup.
| * Parse GFM references after sanitizingVinnie Okada2015-03-281-3/+3
| | | | | | | | | | | | Parse GFM references - labels, issues, MRs, etc. - after calling the HTML Pipeline `SanitizationFilter` so that we can use non-whitelisted attributes like `style`.
* | Merge branch 'reference-access-control' into 'master'Dmitriy Zaporozhets2015-04-131-0/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | 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
| * | Don't require user to every gfm call.Douwe Maan2015-04-031-21/+21
| | |
| * | Fix errors.Douwe Maan2015-04-021-2/+2
| | |
| * | Only allow user to reference objects they have access to.Douwe Maan2015-04-021-18/+20
| | |
* | | Merge branch 'username-period' into 'master'Dmitriy Zaporozhets2015-04-021-1/+1
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | 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
| * | Don't allow username to end in period.Douwe Maan2015-03-271-1/+1
| |/
* | Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ceMarin Jankovski2015-03-311-13/+13
|\ \ | | | | | | | | | | | | Conflicts: lib/gitlab/markdown.rb
| * \ Merge branch 'group-information-leak' into 'master'Dmitriy Zaporozhets2015-04-011-1/+1
| |\ \ | | |/ | |/| | | | | | | | | | Don't leak private group existence by redirecting from namespace controller to group controller. See merge request !440
| | * Don't leak private group existence by redirecting from namespace controller ↵Douwe Maan2015-03-241-1/+1
| | | | | | | | | | | | to group controller.
* | | Use relative URL for Markdown references, except in mails.email-full-urlDouwe Maan2015-03-271-37/+53
|/ /
* | Merge branch 'master' into markdown-tagsVinnie Okada2015-03-241-2/+3
|\ \
| * | Fix nested task listsVinnie Okada2015-03-211-2/+3
| |/ | | | | | | | | When nesting task list items, the parent item is wrapped in a `<p>` tag. Update the task list parser to handle these paragraph wrappers.
* | Fix SanitizationFilter bugsVinnie Okada2015-03-221-1/+2
| | | | | | | | | | | | | | | | 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.
* | Don't allow style attributes in inline HTMLVinnie Okada2015-03-211-1/+1
| |
* | Change HTML sanitizationVinnie Okada2015-03-191-13/+23
| | | | | | | | | | Use the `SanitizationFilter` class from the html-pipeline gem for inline HTML instead of calling the Rails `sanitize` method.
* | Merge branch 'master' into markdown-tagsVinnie Okada2015-03-171-30/+101
|\ \ | |/ | | | | Use the latest HTML pipeline gem
| * Merge branch 'atom-xhtml-squashed' into 'master'Douwe Maan2015-03-171-8/+22
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix invalid Atom feeds when using emoji, horizontal rules, or images This is a fix for issues #880, #723, #1113. Markdown must be rendered to XHTML, not HTML, when generating summary content for Atom feeds. Otherwise, content-less tags like *img* and *hr* are not terminated and make the Atom XML invalid. Such tags are generated when issue descriptions, merge request descriptions, comments, or commit messages use emoji, horizontal rules, or images. To pass this option through from the relevant Haml templates to the proper place in the `gfm()` method, a new method `gfm_with_options()` is introduced. It reuses the options dictionary passed to `markdown()` and interprets options `xhtml` and `parse_tasks` from it (the latter was a convenient replacement for `gfm_with_tasks()`). `xhtml` is already interpreted by Redcarpet::Render::HTML, but that alone was not sufficient, because the post-processing in `gfm()` would convert its XHTML tags back to HTML. I found no way of passing additional optional options to the existing `gfm()` method without requiring updates to existing callers and without getting in the way of the existing optional arguments, but maybe someone who knows more about Ruby than I can think of one. Thorough review appreciated since this is the first time I have used Ruby. See merge request !344
| | * Fix invalid Atom feeds when using emoji, horizontal rules, or images.Christian Walther2015-03-161-8/+22
| | | | | | | | | | | | Fixes issues #880, #723, #1113: Markdown must be rendered to XHTML, not HTML, when generating summary content for Atom feeds. Otherwise, content-less tags like <img> and <hr>, generated when issue descriptions, merge request descriptions, comments, or commit messages use emoji, horizontal rules, or images, are not terminated and make the Atom XML invalid.
| * | Use `project_member` instead of `team_member`.Douwe Maan2015-03-151-1/+1
| | |
| * | Automatically link commit ranges to compare page.Douwe Maan2015-03-071-1/+27
| | |
| * | Support names starting with a digit or _ for projects and usersNicolas Bouilleaud2015-03-021-1/+1
| | | | | | | | | | | | This is what’s actually allowed when creating a user or a project in gitlab.
| * | Upgrade to Rails 4.1.9Vinnie Okada2015-02-141-6/+10
| |/ | | | | | | | | | | Make the following changes to deal with new behavior in Rails 4.1.2: * Use nested resources to avoid slashes in arguments to path helpers.
| * Add labels notesNikita Verkhovin2015-02-081-2/+16
| |