diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-04-03 01:48:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-02 17:48:27 +0000 |
commit | ca5c895efb91d2c2f17a83460e1753101c6f6bb1 (patch) | |
tree | 351c56aa353b6147e335dbdb3892e513690ea0e8 /web_src/css/markup | |
parent | eb505b128c7b9b2459f2a5d20b5740017125178b (diff) | |
download | gitea-ca5c895efb91d2c2f17a83460e1753101c6f6bb1.tar.gz gitea-ca5c895efb91d2c2f17a83460e1753101c6f6bb1.zip |
Render embedded code preview by permlink in markdown (#30234)
The permlink in markdown will be rendered as a code preview block, like GitHub
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'web_src/css/markup')
-rw-r--r-- | web_src/css/markup/codepreview.css | 36 | ||||
-rw-r--r-- | web_src/css/markup/content.css | 4 |
2 files changed, 38 insertions, 2 deletions
diff --git a/web_src/css/markup/codepreview.css b/web_src/css/markup/codepreview.css new file mode 100644 index 0000000000..9219544993 --- /dev/null +++ b/web_src/css/markup/codepreview.css @@ -0,0 +1,36 @@ +.markup .code-preview-container { + border: 1px solid var(--color-secondary); + border-radius: var(--border-radius); + margin: 0.25em 0; +} + +.markup .code-preview-container .code-preview-header { + border-bottom: 1px solid var(--color-secondary); + padding: 0.5em; + font-size: 12px; +} + +.markup .code-preview-container table { + width: 100%; + max-height: 100px; + overflow-y: auto; + margin: 0; /* override ".markup table {margin}" */ +} + +/* workaround to hide empty p before container - more details are in "html_codepreview.go" */ +.markup p:empty:has(+ .code-preview-container) { + display: none; +} + +/* override the polluted styles from the content.css: ".markup table ..." */ +.markup .code-preview-container table tr { + border: 0 !important; +} +.markup .code-preview-container table th, +.markup .code-preview-container table td { + border: 0 !important; + padding: 0 0 0 5px !important; +} +.markup .code-preview-container table tr:nth-child(2n) { + background: none !important; +} diff --git a/web_src/css/markup/content.css b/web_src/css/markup/content.css index 5eeef078a5..376d3030c7 100644 --- a/web_src/css/markup/content.css +++ b/web_src/css/markup/content.css @@ -382,7 +382,7 @@ text-align: center; } -.markup span.align-center span img +.markup span.align-center span img, .markup span.align-center span video { margin: 0 auto; text-align: center; @@ -432,7 +432,7 @@ text-align: right; } -.markup code, +.markup code:not(.code-inner), .markup tt { padding: 0.2em 0.4em; margin: 0; |