diff options
author | silverwind <me@silverwind.io> | 2023-08-31 07:01:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-31 05:01:01 +0000 |
commit | 3d109861ddf95846905143b4cf39129bf253161e (patch) | |
tree | b3d9a4913f1041bbd58f1ae375c6a209e34b63df /modules | |
parent | c35b16a9a491ffbd093bf3e759e94cdbc960fe9c (diff) | |
download | gitea-3d109861ddf95846905143b4cf39129bf253161e.tar.gz gitea-3d109861ddf95846905143b4cf39129bf253161e.zip |
Render code blocks in repo description (#26830)
Backtick syntax now works in repo description too. Also, I replaced the
CSS for this was a new single class, making it more flexible and not
dependent on a parent. Also, very slightly reduced font size from 16.8px
to 16px.
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/templates/util_render.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/templates/util_render.go b/modules/templates/util_render.go index d23103ce1b..ed6eae326a 100644 --- a/modules/templates/util_render.go +++ b/modules/templates/util_render.go @@ -108,10 +108,9 @@ func RenderCommitBody(ctx context.Context, msg, urlPrefix string, metas map[stri // Match text that is between back ticks. var codeMatcher = regexp.MustCompile("`([^`]+)`") -// RenderCodeBlock renders "`…`" as highlighted "<code>" block. -// Intended for issue and PR titles, these containers should have styles for "<code>" elements +// RenderCodeBlock renders "`…`" as highlighted "<code>" block, intended for issue and PR titles func RenderCodeBlock(htmlEscapedTextToRender template.HTML) template.HTML { - htmlWithCodeTags := codeMatcher.ReplaceAllString(string(htmlEscapedTextToRender), "<code>$1</code>") // replace with HTML <code> tags + htmlWithCodeTags := codeMatcher.ReplaceAllString(string(htmlEscapedTextToRender), `<code class="inline-code-block">$1</code>`) // replace with HTML <code> tags return template.HTML(htmlWithCodeTags) } |