1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-15 06:34:25 +00:00
gitea/modules/structs/miscellaneous.go
Brecht Van Lommel 84daddc2fa
Editor preview support for external renderers (#23333)
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>
2023-03-24 14:12:23 +08:00

80 lines
1.5 KiB
Go

// Copyright 2015 The Gogs Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs
// SearchResults results of a successful search
type SearchResults struct {
OK bool `json:"ok"`
Data []*Repository `json:"data"`
}
// SearchError error of a failed search
type SearchError struct {
OK bool `json:"ok"`
Error string `json:"error"`
}
// MarkupOption markup options
type MarkupOption struct {
// Text markup to render
//
// in: body
Text string
// Mode to render (comment, gfm, markdown, file)
//
// in: body
Mode string
// Context to render
//
// in: body
Context string
// Is it a wiki page ?
//
// in: body
Wiki bool
// File path for detecting extension in file mode
//
// in: body
FilePath string
}
// MarkupRender is a rendered markup document
// swagger:response MarkupRender
type MarkupRender string
// MarkdownOption markdown options
type MarkdownOption struct {
// Text markdown to render
//
// in: body
Text string
// Mode to render (comment, gfm, markdown)
//
// in: body
Mode string
// Context to render
//
// in: body
Context string
// Is it a wiki page ?
//
// in: body
Wiki bool
}
// MarkdownRender is a rendered markdown document
// swagger:response MarkdownRender
type MarkdownRender string
// ServerVersion wraps the version of the server
type ServerVersion struct {
Version string `json:"version"`
}
// APIError is an api error with a message
type APIError struct {
Message string `json:"message"`
URL string `json:"url"`
}