mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Fix markdown render behaviors (#34122)
* Fix #27645 * Add config options `MATH_CODE_BLOCK_DETECTION`, problematic syntaxes are disabled by default * Fix #33639 * Add config options `RENDER_OPTIONS_*`, old behaviors are kept
This commit is contained in:
@@ -200,9 +200,9 @@ func ViewPost(ctx *context_module.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: "ComposeMetas" (usually for comment) is not quite right, but it is still the same as what template "RenderCommitMessage" does.
|
||||
// TODO: "ComposeCommentMetas" (usually for comment) is not quite right, but it is still the same as what template "RenderCommitMessage" does.
|
||||
// need to be refactored together in the future
|
||||
metas := ctx.Repo.Repository.ComposeMetas(ctx)
|
||||
metas := ctx.Repo.Repository.ComposeCommentMetas(ctx)
|
||||
|
||||
// the title for the "run" is from the commit message
|
||||
resp.State.Run.Title = run.Title
|
||||
|
@@ -278,7 +278,7 @@ func ViewIssue(ctx *context.Context) {
|
||||
extIssueUnit, err := ctx.Repo.Repository.GetUnit(ctx, unit.TypeExternalTracker)
|
||||
if err == nil && extIssueUnit != nil {
|
||||
if extIssueUnit.ExternalTrackerConfig().ExternalTrackerStyle == markup.IssueNameStyleNumeric || extIssueUnit.ExternalTrackerConfig().ExternalTrackerStyle == "" {
|
||||
metas := ctx.Repo.Repository.ComposeMetas(ctx)
|
||||
metas := ctx.Repo.Repository.ComposeCommentMetas(ctx)
|
||||
metas["index"] = ctx.PathParam("index")
|
||||
res, err := vars.Expand(extIssueUnit.ExternalTrackerConfig().ExternalTrackerFormat, metas)
|
||||
if err != nil {
|
||||
|
@@ -176,7 +176,7 @@ func prepareToRenderFile(ctx *context.Context, entry *git.TreeEntry) {
|
||||
if markupType != "" && !shouldRenderSource {
|
||||
ctx.Data["IsMarkup"] = true
|
||||
ctx.Data["MarkupType"] = markupType
|
||||
metas := ctx.Repo.Repository.ComposeDocumentMetas(ctx)
|
||||
metas := ctx.Repo.Repository.ComposeRepoFileMetas(ctx)
|
||||
metas["RefTypeNameSubURL"] = ctx.Repo.RefTypeNameSubURL()
|
||||
rctx := renderhelper.NewRenderContextRepoFile(ctx, ctx.Repo.Repository, renderhelper.RepoFileOptions{
|
||||
CurrentRefPath: ctx.Repo.RefTypeNameSubURL(),
|
||||
|
Reference in New Issue
Block a user