summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/misc/markdown.go
Commit message (Collapse)AuthorAgeFilesLines
* Editor preview support for external renderers (#23333)Brecht Van Lommel2023-03-241-127/+0
| | | | | | | | | | | | | | | | | | | | | | | | Remove `[repository.editor] PREVIEWABLE_FILE_MODES` setting that seemed like it was intended to support this but did not work. Instead, whenever viewing a file shows a preview, also have a Preview tab in the file editor. Add new `/markup` web and API endpoints with `comment`, `gfm`, `markdown` and new `file` mode that uses a file path to determine the renderer. Remove `/markdown` web endpoint but keep the API for backwards and GitHub compatibility. ## ⚠️ BREAKING ⚠️ The `[repository.editor] PREVIEWABLE_FILE_MODES` setting was removed. This setting served no practical purpose and was not working correctly. Instead a preview tab is always shown in the file editor when supported. --------- Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Implement FSFE REUSE for golang files (#21840)flynnnnnnnnnn2022-11-271-2/+1
| | | | | | | | | Change all license headers to comply with REUSE specification. Fix #16132 Co-authored-by: flynnnnnnnnnn <flynnnnnnnnnn@github> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Propagate context and ensure git commands run in request context (#17868)zeripath2022-01-191-1/+5
| | | | | | | | | This PR continues the work in #17125 by progressively ensuring that git commands run within the request context. This now means that the if there is a git repo already open in the context it will be used instead of reopening it. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Refactor renders (#15175)Lunny Xiao2021-04-191-24/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor renders * Some performance optimization * Fix comment * Transform reader * Fix csv test * Fix test * Fix tests * Improve optimaziation * Fix test * Fix test * Detect file encoding with reader * Improve optimaziation * reduce memory usage * improve code * fix build * Fix test * Fix for go1.15 * Fix render * Fix comment * Fix lint * Fix test * Don't use NormalEOF when unnecessary * revert change on util.go * Apply suggestions from code review Co-authored-by: zeripath <art27@cantab.net> * rename function * Take NormalEOF back Co-authored-by: zeripath <art27@cantab.net>
* Move macaron to chi (#14293)Lunny Xiao2021-01-261-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use [chi](https://github.com/go-chi/chi) instead of the forked [macaron](https://gitea.com/macaron/macaron). Since macaron and chi have conflicts with session share, this big PR becomes a have-to thing. According my previous idea, we can replace macaron step by step but I'm wrong. :( Below is a list of big changes on this PR. - [x] Define `context.ResponseWriter` interface with an implementation `context.Response`. - [x] Use chi instead of macaron, and also a customize `Route` to wrap chi so that the router usage is similar as before. - [x] Create different routers for `web`, `api`, `internal` and `install` so that the codes will be more clear and no magic . - [x] Use https://github.com/unrolled/render instead of macaron's internal render - [x] Use https://github.com/NYTimes/gziphandler instead of https://gitea.com/macaron/gzip - [x] Use https://gitea.com/go-chi/session which is a modified version of https://gitea.com/macaron/session and removed `nodb` support since it will not be maintained. **BREAK** - [x] Use https://gitea.com/go-chi/captcha which is a modified version of https://gitea.com/macaron/captcha - [x] Use https://gitea.com/go-chi/cache which is a modified version of https://gitea.com/macaron/cache - [x] Use https://gitea.com/go-chi/binding which is a modified version of https://gitea.com/macaron/binding - [x] Use https://github.com/go-chi/cors instead of https://gitea.com/macaron/cors - [x] Dropped https://gitea.com/macaron/i18n and make a new one in `code.gitea.io/gitea/modules/translation` - [x] Move validation form structs from `code.gitea.io/gitea/modules/auth` to `code.gitea.io/gitea/modules/forms` to avoid dependency cycle. - [x] Removed macaron log service because it's not need any more. **BREAK** - [x] All form structs have to be get by `web.GetForm(ctx)` in the route function but not as a function parameter on routes definition. - [x] Move Git HTTP protocol implementation to use routers directly. - [x] Fix the problem that chi routes don't support trailing slash but macaron did. - [x] `/api/v1/swagger` now will be redirect to `/api/swagger` but not render directly so that `APIContext` will not create a html render. Notices: - Chi router don't support request with trailing slash - Integration test `TestUserHeatmap` maybe mysql version related. It's failed on my macOS(mysql 5.7.29 installed via brew) but succeed on CI. Co-authored-by: 6543 <6543@obermui.de>
* Allow different HardBreaks settings for documents and comments (#11515)zeripath2020-05-241-2/+12
| | | | | | | | | | | | | | | | GH has different HardBreaks behaviour for markdown comments and documents. Comments have hard breaks and documents have soft breaks - therefore Gitea's rendering will always be different from GH's if we only provide one setting. Here we split the setting in to two - one for documents and one for comments and other things. Signed-off-by: Andrew Thornton art27@cantab.net Changes to index.js as per @silverwind Co-authored-by: silverwind <me@silverwind.io> Changes to docs as per @guillep2k Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Swagger info corrections (#9441)65432019-12-201-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * use numbers and not http.Status___ enum * fix test * add many missing swagger responses * code format * Deletion Sould return 204 ... * error handling improvements * if special error type ... then add it to swagger too * one smal nit * invalidTopicsError is []string * valid swagger specification 2.0 - if you add responses swagger can tell you if you do it right :+1: * use ctx.InternalServerError * Revert "use numbers and not http.Status___ enum" This reverts commit b1ff386e2418ed6a7f183e756b13277d701278ef. * use http.Status* enum everywhere
* Use gitea forked macaron (#7933)Tamal Saha2019-08-231-2/+1
| | | Signed-off-by: Tamal Saha <tamal@appscode.com>
* Add golangci (#6418)kolaente2019-06-121-5/+22
|
* Move sdk structs to modules/structs (#6905)Lunny Xiao2019-05-111-1/+1
| | | | | | | | | | | | * move sdk structs to moduels/structs * fix tests * fix fmt * fix swagger * fix vendor
* Improve issue autolinks (#6273)mrsdizzie2019-04-121-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Fix swagger errors (#4220)Antoine GIRARD2018-06-121-3/+6
| | | | | | | | | | Fix all the resting errors to have a valid swagger file. They are still some warnings but nothing blocking. Doing so I found that some request still misses son parameters for some POST/PUT/PATCH request. This means the a client generated from the swagger file will not work completely. Fix #4088 by activating validation in drone Should fix #4010.
* Populate URL field of API commits (#3546)Ethan Koenig2018-02-201-2/+2
| | | | | | * Populate URL field of API commits * fix orgmode_test
* Update swagger documentation (#2899)Ethan Koenig2017-11-131-20/+30
| | | | | | | | | | | * Update swagger documentation Add docs for missing endpoints Add documentation for request parameters Make parameter naming consistent Fix response documentation * Restore delete comments
* Add init support of orgmode document type on file view and readme (#2525)Lunny Xiao2017-09-211-1/+1
| | | | | | | | | | | | | | * 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-161-1/+2
| | | | | | | | | | * restructure markup & markdown to prepare for multiple markup languages support * adjust some functions between markdown and markup * fix tests * improve the comments
* Improve swagger doc (#2274)Antoine GIRARD2017-08-211-2/+2
| | | | | | | | | | | | | | | | | | | | * Add swagger comment for adminCreateOrg * Add swagger comment for admin route * add hook swagger doc * Add tags * Add auth * Fix name of responses * Edit name method * Update vendor * make generate-swagger
* Generate swagger json (#1402)Antoine GIRARD2017-05-021-2/+23
| | | | | | | - Generate swagger.json into public/ - Add swagger-ui auto-installation - Add footer link to local swagger-ui - Add /swagger url for using app url. - Fix Swagger-UI version via git tag
* Fix URL handling in the whole markdown module, improve test coverage (#1027)Andrew Boyarshin2017-02-241-1/+7
| | | | | Amended with string to bool change in API SDK. Signed-off-by: Andrew Boyarshin <andrew.boyarshin@gmail.com>
* Markdown rendering overhaul (#186)Andrew Boyarshin2017-02-141-3/+4
| | | | | | | | | | | | * Markdown rendering overhaul Cleaned up and squashed commits into single one. Signed-off-by: Andrew Boyarshin <boyarshinand@gmail.com> * Fix markdown API, add markdown module and API tests, improve code coverage Signed-off-by: Andrew Boyarshin <boyarshinand@gmail.com>
* Golint fixed for modules/contextLunny Xiao2016-11-251-1/+1
|
* golint fixed for routers (#208)Lunny Xiao2016-11-241-2/+4
|
* Fix import path of go-sdk (#141)Sandro Santilli2016-11-111-1/+1
| | | | From code.gitea.io/go-sdk/gitea To code.gitea.io/sdk/gitea
* Update import paths from github.com/go-gitea to code.gitea.io (#135)Sandro Santilli2016-11-101-3/+3
| | | | | | | - Update import paths from github.com/go-gitea to code.gitea.io - Fix import path for travis See https://docs.travis-ci.com/user/languages/go#Go-Import-Path
* Replaced go-gogs-client with go-sdk importsThomas Boerger2016-11-071-1/+1
|
* Change import reference to match gitea instead of gogs (#37)Rémy Boulanouar2016-11-031-2/+2
|
* Convert all API handers to use *context.APIContextUnknwon2016-03-131-4/+4
|
* Rename module: middleware -> contextUnknwon2016-03-111-3/+3
|
* Make markdown as an independent moduleUnknwon2016-02-201-4/+4
|
* fix #1829 and fix #890Unknwon2015-12-041-1/+1
|
* refactor API routes and some work for #976Unknwon2015-12-041-0/+42