aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup
Commit message (Collapse)AuthorAgeFilesLines
* fix hljs unintenionally highlighting commit links (#7244)silverwind2019-06-182-4/+5
| | | | | | * fix hljs unintenionally highlighting commit links * fix unit tests
* Add golangci (#6418)kolaente2019-06-122-38/+1
|
* Fix wrong init dependency on markup extensions (#7038)Lunny Xiao2019-05-251-0/+8
| | | | * fix wrong init dependency on markup extensions
* Fix domain name pattern in email regex (#6739)mrsdizzie2019-04-242-1/+16
| | | Fixes #6735
* Use ctx.metas for SHA hash links (#6645)mrsdizzie2019-04-163-4/+16
| | | | | | | | Since #6273 was merged, we now have access to proper context metas always. Update SHA generated links to use these instead of urlPrefix. Update tests as well. Fixes #4536.
* Improve issue autolinks (#6273)mrsdizzie2019-04-123-16/+52
| | | | | | | | | | | | | | | | | | | | | | | | | * Improve issue autolinks Update autolinks to match what github does here: Issue in same repo: #1 Issue in different repo: org/repo#1 Fixes #6264 * Use setting.AppURL when parsing URL Using setting.AppURL here is a more reliable way of parsing the current URL and what other functions in this file seem to use. * Make ComposeMetas always return a valid context * Add per repository markdown renderers for better context * Update for use of context metas Now that we include the user and repo name inside context metas, update various code and tests for this new logic
* Render SHA1 links as code blocks (#6546)silverwind2019-04-093-23/+40
|
* Use stricter boundaries for auto-link detection (#6522)mrsdizzie2019-04-073-11/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use stricter boundaries for auto-link detection Currently autolinks use \W for boundary detection which creates many situations of inserting links into places they don't belong (paths, URLs, UUIDs, etc...) This fixes that by replacing \W and only allowing these matches to touch an open paren or bracket (matching what seems to be Github behavior) in addition to whitespace and start of line. Similar for ending boundary as well. Fixes #6149 (and probably others) * Update test Replace incorrect test with a value that is a valid username, based on: "Username should contain only alphanumeric, dash ('-'), underscore ('_') and dot ('.') characters." * Also allow for period at the end Matching Github behavior * Fix email regex to work properly with specificed boundaries Create a specific capture group for email address and then use FindStringSubmatchIndex to allow for non-matching patterns as boundaries. * Add Tests Add tests for new behavior -- including tests for email addresses which were absent before.
* Improve SHA1 link detection (#6526)silverwind2019-04-062-21/+36
| | | | | | | | This improves the SHA1 link detection to not pick up extraneous non-whitespace characters at the end of the URL. The '.' is a special case handled in code itself because of missing regexp lookahead support. Regex test cases: https://regex101.com/r/xUMlqh/3
* Better logging (#6038) (#6095)zeripath2019-04-023-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Panic don't fatal on create new logger Fixes #5854 Signed-off-by: Andrew Thornton <art27@cantab.net> * partial broken * Update the logging infrastrcture Signed-off-by: Andrew Thornton <art27@cantab.net> * Reset the skip levels for Fatal and Error Signed-off-by: Andrew Thornton <art27@cantab.net> * broken ncsa * More log.Error fixes Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove nal * set log-levels to lowercase * Make console_test test all levels * switch to lowercased levels * OK now working * Fix vetting issues * Fix lint * Fix tests * change default logging to match current gitea * Improve log testing Signed-off-by: Andrew Thornton <art27@cantab.net> * reset error skip levels to 0 * Update documentation and access logger configuration * Redirect the router log back to gitea if redirect macaron log but also allow setting the log level - i.e. TRACE * Fix broken level caching * Refactor the router log * Add Router logger * Add colorizing options * Adjust router colors * Only create logger if they will be used * update app.ini.sample * rename Attribute ColorAttribute * Change from white to green for function * Set fatal/error levels * Restore initial trace logger * Fix Trace arguments in modules/auth/auth.go * Properly handle XORMLogger * Improve admin/config page * fix fmt * Add auto-compression of old logs * Update error log levels * Remove the unnecessary skip argument from Error, Fatal and Critical * Add stacktrace support * Fix tests * Remove x/sync from vendors? * Add stderr option to console logger * Use filepath.ToSlash to protect against Windows in tests * Remove prefixed underscores from names in colors.go * Remove not implemented database logger This was removed from Gogs on 4 Mar 2016 but left in the configuration since then. * Ensure that log paths are relative to ROOT_PATH * use path.Join * rename jsonConfig to logConfig * Rename "config" to "jsonConfig" to make it clearer * Requested changes * Requested changes: XormLogger * Try to color the windows terminal If successful default to colorizing the console logs * fixup * Colorize initially too * update vendor * Colorize logs on default and remove if this is not a colorizing logger * Fix documentation * fix test * Use go-isatty to detect if on windows we are on msys or cygwin * Fix spelling mistake * Add missing vendors * More changes * Rationalise the ANSI writer protection * Adjust colors on advice from @0x5c * Make Flags a comma separated list * Move to use the windows constant for ENABLE_VIRTUAL_TERMINAL_PROCESSING * Ensure matching is done on the non-colored message - to simpify EXPRESSION
* Change order that PostProcess Processors are run (#6445)mrsdizzie2019-03-272-7/+13
| | | | | | | | | | Make sure Processors that work on full links are run first so that something matching another pattern doesn't alter a link before we get to it, for example: https://stackoverflow.com/questions/2896191/what-is-go-used-fore Fixes #4813
* Use Go1.11 module (#5743)Mura Li2019-03-271-1/+1
| | | | | | | | | | | | | | | | | | * Migrate to go modules * make vendor * Update mvdan.cc/xurls * make vendor * Update code.gitea.io/git * make fmt-check * Update github.com/go-sql-driver/mysql * make vendor
* Markdown: enable some more extensions (#6362)Roland Koebler2019-03-212-4/+72
| | | | | | | | | | | | | | * Markdown: enable some more extensions Improve Markdown-rendering by enabling some extensions: - enable definitions lists - enable footnotes - enable header-ids and automatically generate header-ids (for linking to README-sections or creating table-of-contents for larger READMEs) * Markdown: update and exted tests Update and add tests for additionally enabled Markdown-extensions.
* Fix reported issue in repo description (#6306)zeripath2019-03-111-0/+48
|
* Replace linkRegex with xurls library (#6261)mrsdizzie2019-03-072-3/+11
| | | | | | | | | | | | | | | | | | | | * Replace linkRegex with xurls library Rather than maintaining a complicated regex to match URLs for autolinking, gitea can use this existing go library that takes care of the matching with very little code change to gitea itself. After spending a while trying to find the perfect regex for all cases this library still works better as it is more flexible than a single regex ever will be. This will also fix the following issues: #5844 #3095 #3381 This passes all our current tests and I've added new ones mentioned in those issues as well. * Use xurls.StrictMatchingScheme instead of xurls.Strict This is much faster and we only care about https? links to preserve existing behavior.
* Remove visitLinksForShortLinks features (#6257)mrsdizzie2019-03-072-14/+9
| | | | | | | | | | | | | | | | | | | | | | The visitLinksForShortLinks feature would look inside of an <a> tag and run shortLinkProcessorFull on any text, which attempts to create links out of potential 'short links' like [[test]] [[link|example]] etc... This makes no sense because you can't have nested links within an <a> tag. Specifically, the html5 standard says <a> tags can't include interactive content if they contain the href attribute: http://w3c.github.io/html/single-page.html#the-a-element And also defines an <a> element with a href attribute as interactive: http://w3c.github.io/html/single-page.html#interactive-content Therefore you can't really put a link inside of another link. In practice none of this works anyways since browsers won't render it, it would probably be broken if they tried, and it is causing a bug (#4946). No current tests rely on this behavior either. This removes the feature and also explicitly excludes the current visitNodeForShortLinks from looking in <a> tags.
* Modify linkRegex to require http|https (#6171)mrsdizzie2019-02-282-1/+63
| | | | | Modify the current linkRegex to require http|https which appears to be the intended behavior based on the comments. Right now, it also matches anything starting with www as well. Also add testing for linkRegex
* Allow markdown files to read from the LFS (#5787)zeripath2019-02-121-1/+1
| | | | | | | This PR makes it possible for the markdown renderer to render images and media straight from the LFS. Fix #5746 Signed-off-by: Andrew Thornton [art27@cantab.net](mailto:art27@cantab.net)
* Recover panic in orgmode.Render if bad orgfile (#4982) (#5903)zeripath2019-01-301-4/+10
| | | | | | | This PR protects against the panic referred to in chaseadmsio/goorgeous#82 by recovering from the panic and just returning the raw bytes if there is an error. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Prioritize "readme.md" (#5691)Khaled Hamed2019-01-142-2/+29
| | | | | | | | * prioritize readme.md * Improve IsReadmeFile * Add more tests
* support envs on external render commands (#5278)Lunny Xiao2018-11-201-5/+17
|
* Fix markdown image with link (#4675)L.E.R2018-10-302-22/+21
| | | | | | | | | | * Fix markdown image with link * Add gitea copyright notice * add a test for markdown image with link * remove svg related variables
* Pass link prefixes to external markup parsers (#5201)Nicolas Lenz2018-10-301-0/+5
| | | | | | | | | | | | | | * Pass environment variables for URL prefixes to external markup parser Signed-off-by: Nicolas Lenz <nicolas@eisfunke.com> * Document external markup link prefix environment variables Signed-off-by: Nicolas Lenz <nicolas@eisfunke.com> * Run format on link prefix changes Signed-off-by: Nicolas Lenz <nicolas@eisfunke.com>
* Upgrade images in .drone.yml to more recent versions (#4819)techknowlogick2018-08-291-4/+4
|
* Add csv file render support defaultly (#4105)Lunny Xiao2018-07-212-0/+83
| | | | | | * add csv file render support defaultly * escaping csv column content
* Replace src with raw to fix image paths (#4377)Jonas Franz2018-07-051-1/+1
| | | Signed-off-by: Jonas Franz <info@jonasfranz.software>
* markup: escape short wiki link (#4091)Antoine GIRARD2018-06-152-0/+29
|
* Fix wiki inter-links with cases and add tests for this case (#3560)Chaz Reid2018-03-052-6/+16
|
* Rework special link parsing in the post-processing of markup (#3354)Morgan Bazalgette2018-02-276-910/+991
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Get rid of autolink * autolink in markdown * Replace email addresses with mailto links * better handling of links * Remove autolink.js from footer * Refactor entire html.go * fix some bugs * Make tests green, move what we can to html_internal_test, various other changes to processor logic * Make markdown tests work again This is just a description to allow me to force push in order to restart the drone build. * Fix failing markdown tests in routers/api/v1/misc * Add license headers, log errors, future-proof <body> * fix formatting
* Populate URL field of API commits (#3546)Ethan Koenig2018-02-205-82/+46
| | | | | | * Populate URL field of API commits * fix orgmode_test
* Allow square brackets in external issue patterns (#3408)Christian Köberl2018-02-032-2/+7
| | | | | | * Allow square brackets in external issue patterns * Added false test cases for checklist elements
* Recognize more characters in crossreferenced repo name (#3413)Lauris BH2018-01-272-1/+4
|
* Fix issue link rendering in commit messages (#2897)Ethan Koenig2017-11-132-26/+98
| | | | | | | | | | * Fix issue link rendering in commit messages * Update page.tmpl * No links for parens * remove comment
* Add external markup render support (#2570)Lunny Xiao2017-11-071-0/+88
| | | | | | | | | | | | | | | | | | | | | | * add external markup render support * bug fixed * refacotr codes and fix wrong error log * fix comments and add check to prevent leaks * add check for config file and improve the example * check file close error * use ioutil.TempFile instead uuid * correct Render -> Parser * improve warning when incorrect markup setting * fix typos
* Add init support of orgmode document type on file view and readme (#2525)Lunny Xiao2017-09-216-2/+614
| | | | | | | | | | | | | | * add init support of orgmode document type on file view and readme * fix imports * fix imports and readmeExist * fix imports order * fix format * remove unnecessary convert
* Restructure markup & markdown to prepare for multiple markup language… (#2411)Lunny Xiao2017-09-166-24/+1140
| | | | | | | | | | * restructure markup & markdown to prepare for multiple markup languages support * adjust some functions between markdown and markup * fix tests * improve the comments
* gofmt (#1710)Ethan Koenig2017-05-121-1/+0
|
* markup: microoptimise for many short filenames in directory (#1534)mappu2017-05-092-2/+6
| | | | | | | | * markup: microoptimise for many short filenames in directory Move strings.ToLower() after the early-return length check. This is a safe operation in all cases and should slightly improve directory listing performance when a directory contains many thousands of files with short filenames. * markup: expand test cases for IsReadmeFile()
* fix multiple readme file rendering and fix #1657 (#1658)Lunny Xiao2017-05-021-0/+9
| | | | | | * fix multiple readme file rendering and fix #1657 * remove unnecessary loop
* Add markup package to prepare for org markup format (#1493)Lunny Xiao2017-04-212-0/+108