Commit Graph

47 Commits

Author SHA1 Message Date
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
Stefan Tatschner f736721c5b Replace Rugments with Rouge
I have mainly created the rugments fork for the purpose of improving
gitlab's highlighting. Nowadays IMO it works way better than the old
highlight.js solution. But the development is stuck on my side because
of a couple of personal reasons:

  * I have finished my studies; last months I was writing my master
    thesis. So there was a huge time problem. I am sorry for that.

  * I had to move to Munich due to getting a (paid) job. Searching a
    flat here is horrible... :)

  * Last but not least, maintaining the same code base in two seperate
    projects is a mess.

I have decided to switch back to rouge due to several reasons:

  * In the beginning I was quite motivated, but since I start
    working on my new job next week, the best solution IMO is
    switching back to upstream rouge.

  * Rouge is continously improving:
    https://github.com/jneen/rouge/blob/master/CHANGELOG.md
    http://rouge.jneen.net/

  * There should be absolutely no regressions with this change. Most
    likely this pull request will almost fix some minor bugs.

  * One less gem in gitlab is a good thing. since Gitlab is quite a
    huge bundle of gems. Reducing complexity should be a major
    milestone.

Thanks a lot to @stanhu and @jneen for the review!
2015-07-29 07:40:58 +02:00
Douwe Maan 1f908dc481 Fix typo. 2015-06-02 13:21:34 +02:00
Douwe Maan fe78984f20 Actually ignore references in code blocks etc. 2015-06-02 13:17:11 +02:00
Douwe Maan cd52cef1c0 Fix reference links in dashboard activity and ATOM feeds. 2015-05-14 13:05:33 +02:00
Jakub Jirutka f7adac87fe Extract handling of relative file links to RelativeLinkFilter 2015-05-11 02:07:26 +02:00
Robert Speicher 242bebc134 Remove special handling for the `'` problem
While `escape_once` will create this HTML entity, Nokogiri always
translates it back before it gets to IssueReferenceFilter, so there
should be no danger of erroneous issue links.
2015-04-30 16:35:27 -04:00
Robert Speicher 421edd3545 Escape normal text in our Redcarpet renderer 2015-04-30 16:35:26 -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
Douwe Maan e4ac6bbf82 Merge branch 'atom-xhtml-squashed' into 'master'
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
2015-03-17 08:38:38 +00:00
Christian Walther 90aa870c36 Fix invalid Atom feeds when using emoji, horizontal rules, or images.
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.
2015-03-16 22:05:52 +01:00
Dmitriy Zaporozhets f29a7ce51f Merge branch 'markdown-smb-link' into 'master'
Allow smb:// links in Markdown text.

As requested by Sam McLeod at https://gitlab.com/gitlab-org/gitlab-ce/issues/1184

See merge request !1669
2015-03-12 03:57:52 +00:00
Stan Hu 4218a2bfcf Fix code preview theme setting for comments, issues, merge requests, and snippets.
Also preserve code preview color scheme in events dashboard.

Assign default colors to all code blocks shown as <pre class="code highlight [color_scheme]">

Closes #1139
2015-03-10 08:11:20 -07:00
Douwe Maan ca9aca9279 Allow smb:// links in Markdown text. 2015-03-10 13:32:28 +01:00
Stefan Tatschner bf079c24af Replace highlight.js with rouge-fork rugments
I decided to create a fork of rouge as rouge lacks a HTML formatter with
the required options such as wrapping a line with <span> tags.
Furthermore I was not really convinced about the clarity of rouge's
source code.

Rugments 1.0.0beta3 for now only includes some basic linting and a new
HTML formatter. Everything else should behave the same.
2015-01-15 13:41:11 +01:00
Marin Jankovski fc2adfb6e4 Add a comment why this is done. 2014-10-10 08:32:05 +02:00
Marin Jankovski 1d14676e0c Substitute right single quote back with apostrophe. 2014-10-10 08:24:58 +02:00
Marin Jankovski 64e72af3cb Replace apostrophe with right single quote to avoid markdown interpretation as issue 39. 2014-10-09 14:20:49 +02:00
Vinnie Okada 9f0083a96c Add task lists to issues and merge requests
Make the Markdown parser recognize "[x]" or "[ ]" at the beginning of a
list item and turn it into a checkbox input.  Users who can modify the
issue or MR can toggle the checkboxes directly or edit the Markdown to
manage the tasks.  Task status is also displayed in the MR and issue
lists.
2014-10-05 22:15:27 -05:00
Marin Jankovski 281643a1bf Add feature spec. 2014-05-26 20:43:58 +02:00
Marin Jankovski 52c3179be9 Do not replace links inside code blocks, less code for the same amount of work. 2014-05-26 20:43:58 +02:00
Dmitriy Zaporozhets 1bd28994cc
Use ProjectWiki instead of GollumWiki in code
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-04-09 14:35:58 +03:00
Marin Jankovski f04d5bfaf6 Wiki will show relative links related to the wiki gollum repository. 2014-03-17 13:06:19 +01:00
Dmitriy Zaporozhets c94dc3de78
html_escape is private for rails 4.0.2 :(
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-27 11:12:12 +02:00
Dmitriy Zaporozhets 4d896a2b86
Enable html_escape for code blocks highlighted in markdown
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-27 09:38:11 +02:00
Ciro Santillli 61748c993d Headers have ids and link to their own id. 2014-02-11 16:23:33 +01:00
Dmitriy Zaporozhets 891ea6f6e6
Improve highlight for notes
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-01-27 18:18:18 +02:00
Dmitriy Zaporozhets 78b2fb5de9
Add highlight.js support to markdown, snippets etc
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-01-27 13:12:58 +02:00
Marin Jankovski 979ca7d6a2 Correct check. 2013-11-08 16:34:15 +01:00
Marin Jankovski ad3defa3c2 Skip relative links render in help page. 2013-10-11 21:41:33 +02:00
Marin Jankovski 5b23a7bbb9 Cover a special case. 2013-10-10 14:29:16 +02:00
Marin Jankovski 06d6f44367 Check for wiki. 2013-10-08 14:21:01 +02:00
Marin Jankovski 817399e3be Show links with correct ref. 2013-10-08 13:07:59 +02:00
Marin Jankovski 810d90dd26 Search and replace relative links in tree/readme 2013-10-08 12:24:50 +02:00
Robert Schilling db325ef940 Fix Pygments 500 error if lexer not found by name. Use first alias instead. fixes #4473, #4451 2013-07-07 19:00:07 +02:00
Sytse Sijbrandij 409b0a0ab5 Fix pygment lexer 500 errors when an alias is used instead of a name. 2013-06-09 21:30:20 +02:00
Riyad Preukschas 2bc78739a7 Fix parsing of ref-like Urls in links and images in GFM
Fixes #2166
2013-01-16 22:39:56 +01:00
Dmitriy Zaporozhets 2398af9ab0 Fixed wierd gitlab markdown issue 2012-12-22 14:18:40 +02:00
Dmitriy Zaporozhets cec866a7ce Improve wiki rendering. Fix pygemnt + markdown invalid html 2012-12-22 13:01:15 +02:00
Riyad Preukschas d2767221a5 Fix code blocks in Markdown not knowing about the user's color scheme 2012-11-27 22:51:07 +01:00
Riyad Preukschas ca54d43f99 Fix 500s because of "missing" lexer 2012-11-10 00:55:56 +01:00
Robert Speicher 7754189187 Fully embrace Ruby 1.9 hash syntax
Didn't bother with files in db/, config/, or features/
2012-08-10 18:25:15 -04:00
Riyad Preukschas 24ec186a83 Update Gitlab Markdown renderer to use GFM 2012-08-02 02:54:05 +02:00
Riyad Preukschas e1b4e22e5c Add render context to markdown renderer 2012-08-01 17:37:12 +02:00
Nihad Abbasov 604725f4f1 specify utf-8 encoding for pygments.rb markdown wrapper 2012-06-08 01:23:31 -07:00
Arthur Schreiber c437e2d7d4 Switch to Redcarpet for Markdown Rendering.
This gives us Github Flavored Markdown, which is awesome.
2012-04-20 23:01:45 +02:00