summaryrefslogtreecommitdiffstats
path: root/services/markup/processorhelper.go
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-05-20 23:02:52 +0200
committerGitHub <noreply@github.com>2023-05-20 23:02:52 +0200
commit32d9c47ec7706d8f06e09b42e09a28d7a0e3c526 (patch)
tree36eeecea9af4a8200c2d8b49e835c88be60cbf2e /services/markup/processorhelper.go
parent1698c15cba8f9eedfcb6af8226f3e97950480aca (diff)
downloadgitea-32d9c47ec7706d8f06e09b42e09a28d7a0e3c526.tar.gz
gitea-32d9c47ec7706d8f06e09b42e09a28d7a0e3c526.zip
Add RTL rendering support to Markdown (#24816)
Support RTL content in Markdown: ![image](https://github.com/go-gitea/gitea/assets/115237/dedb1b0c-2f05-40dc-931a-0d9dc81f7c97) Example document: https://try.gitea.io/silverwind/symlink-test/src/branch/master/bidi-text.md Same on GitHub: https://github.com/silverwind/symlink-test/blob/master/bidi-text.md `dir=auto` enables a browser heuristic that sets the text direction automatically. It is the only way to get automatic text direction. Ref: https://codeberg.org/Codeberg/Community/issues/1021 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'services/markup/processorhelper.go')
-rw-r--r--services/markup/processorhelper.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/services/markup/processorhelper.go b/services/markup/processorhelper.go
index 2897f203a9..3551f85c46 100644
--- a/services/markup/processorhelper.go
+++ b/services/markup/processorhelper.go
@@ -13,6 +13,7 @@ import (
func ProcessorHelper() *markup.ProcessorHelper {
return &markup.ProcessorHelper{
+ ElementDir: "auto", // set dir="auto" for necessary (eg: <p>, <h?>, etc) tags
IsUsernameMentionable: func(ctx context.Context, username string) bool {
mentionedUser, err := user.GetUserByName(ctx, username)
if err != nil {