You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a generic markup class to display externally rendered files and diffs (#15735)
* creates and implements generic markup less class
* How to give custom CSS to externally rendered html
* Clarifies sources of CSS styling of markup
* further clarification of sources of markup styling
* rename _markdown to _markup
* remove defunct import
* fix orphaned reference
* Update docs/content/doc/advanced/external-renderers.en-us.md
* more renames markdown -> markup
* do not suggest less customization
* add back tokens
* fix class whitespace, remove useless if-clause
* remove unused csv-data rules
* use named exports and rename functions
* sort imports
Co-authored-by: HarvsG <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: silverwind <[email protected]>
Copy file name to clipboardExpand all lines: docs/content/doc/advanced/external-renderers.en-us.md
+33
Original file line number
Diff line number
Diff line change
@@ -98,3 +98,36 @@ Once your configuration changes have been made, restart Gitea to have changes ta
98
98
99
99
**Note**: Prior to Gitea 1.12 there was a single `markup.sanitiser` section with keys that were redefined for multiple rules, however,
100
100
there were significant problems with this method of configuration necessitating configuration through multiple sections.
101
+
102
+
## Customizing CSS
103
+
The external renderer is specified in the .ini in the format `[markup.XXXXX]` and the HTML supplied by your external renderer will be wrapped in a `<div>` with classes `markup` and `XXXXX`. The `markup` class provides out of the box styling (as does `markdown` if `XXXXX` is `markdown`). Otherwise you can use these classes to specifically target the contents of your rendered HTML.
104
+
105
+
And so you could write some CSS:
106
+
```css
107
+
.markup.XXXXXhtml {
108
+
font-size: 100%;
109
+
overflow-y: scroll;
110
+
-webkit-text-size-adjust: 100%;
111
+
-ms-text-size-adjust: 100%;
112
+
}
113
+
114
+
.markup.XXXXXbody {
115
+
color: #444;
116
+
font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
117
+
font-size: 12px;
118
+
line-height: 1.7;
119
+
padding: 1em;
120
+
margin: auto;
121
+
max-width: 42em;
122
+
background: #fefefe;
123
+
}
124
+
125
+
.markup.XXXXXp {
126
+
color: orangered;
127
+
}
128
+
```
129
+
130
+
Add your stylesheet to your custom directory e.g `custom/public/css/my-style-XXXXX.css` and import it using a custom header file `custom/templates/custom/header.tmpl`:
Copy file name to clipboardExpand all lines: templates/repo/issue/comment_tab.tmpl
+1-1
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
{{- if .BodyQuery}}{{.BodyQuery}}{{else if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end -}}
<div class="file-view{{if .IsMarkup}}{{.MarkupType}} {{if ne "csv" .MarkupType}}markdown{{end}}{{else if .IsRenderedHTML}}plain-text{{else if .IsTextSource}}code-view{{end}}">
67
+
<div class="file-view{{if .IsMarkup}} markup {{.MarkupType}}{{else if .IsRenderedHTML}}plain-text{{else if .IsTextSource}}code-view{{end}}">
0 commit comments