|
1 | | -# Styling |
| 1 | +# HTML Styling |
2 | 2 |
|
3 | 3 | Styling is handled with HTML templating and regular web design. |
4 | 4 |
|
5 | 5 | ## Templates |
6 | 6 |
|
7 | | -Markdown documents are rendered using Jinja templating. |
| 7 | +Anything in the `/templates/` directory is treated as a [Jinja template](https://jinja.palletsprojects.com/en/stable/templates/), and is used to render pages, rather than being served directly. You can override templates locally and adapt them to make layout changes. |
8 | 8 |
|
9 | | -The following templates are included in the default theme... |
10 | | - |
11 | | -* `templates/base.html` |
| 9 | +The base template for rendering markdown pages is **`templates/base.html`**. |
12 | 10 |
|
13 | 11 | ```html |
14 | 12 | <html> |
@@ -39,42 +37,25 @@ The following templates are included in the default theme... |
39 | 37 | </html> |
40 | 38 | ``` |
41 | 39 |
|
42 | | -The base template used for rendering markdown pages. You can override this template locally and adapt it to make layout changes. |
43 | | - |
44 | | -* `templates/favicon.svg` |
45 | | - |
46 | | -```html |
47 | | -{% set escaped %}<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="90">{{ config['site']['favicon'] }}</text></svg>{% endset %}{{ escaped | e }} |
48 | | -``` |
49 | | - |
50 | | -Included by the base template. This is an SVG used for the favicon, that is included as an inline `data:` URL. |
| 40 | +The following templates are included in [the default theme](https://github.com/encode/mkdocs/blob/main/src/mkdocs/theme/)... |
51 | 41 |
|
52 | | -Enables the `config['site']['favicon']` field to config a unicode emoji to use as the site favicon. |
| 42 | +* `templates/base.html`- The base template used for rendering markdown pages. |
| 43 | +* `templates/favicon.svg` - an SVG used for the favicon, that displays the `config['site']['favicon']` emoji. |
| 44 | +* `templates/pagination.html` - Included by the base template. Renders next and previous page controls. |
53 | 45 |
|
54 | | -* `templates/pagination.html` |
55 | | - |
56 | | -```html |
57 | | -{% if page.previous or page.next %} |
58 | | -<div class="pagination"> |
59 | | - {% if page.previous %} |
60 | | - <a class="previous" href="{{ page.previous['url']}}">← {{ page.previous['title']}}</a> |
61 | | - {% endif %} |
62 | | - {% if page.next %} |
63 | | - <a class="next" href="{{ page.next['url']}}">{{ page.next['title']}} →</a> |
64 | | - {% endif %} |
65 | | -</div> |
66 | | -{% endif %} |
67 | | -``` |
| 46 | +## Media |
68 | 47 |
|
69 | | -Included by the base template. Renders next and previous page controls. |
| 48 | +Any files that are not Markdown pages `*.md`, or templates `/templates/*`, are treated as media documents and are included in the website without modification. |
70 | 49 |
|
71 | | -## Media |
| 50 | +This can include images, stylesheets, javascript, fonts, video and audio. |
72 | 51 |
|
73 | | -The default theme includes the following assets: |
| 52 | +The default theme includes the following media documents... |
74 | 53 |
|
75 | | -* [`css/theme.css`](css/theme.css) — Copy and overide this file in order to change the color palette, the typography, or to other style changes. |
76 | | -* [`css/highlightjs.min.css`](css/highlightjs.min.css) — The default theme uses the `github-dark` code highlighting style. Override this file to use a different `highlight.js` code highlighting style. |
77 | | -* [`css/highlightjs-copy.min.css`](css/highlightjs.min.css) — *...* |
78 | | -* [`js/theme.js`](js/theme.js) — Copy and override this file in order to add custom scripting. |
79 | | -* [`js/highlightjs.min.js`](js/highlightjs.min.js) — The default theme uses the default supported languages with `highlight.js`. Override this file to support a different set of programming languages. |
| 54 | +* [`css/theme.css`](css/theme.css) |
| 55 | +* [`css/highlightjs.min.css`](css/highlightjs.min.css) |
| 56 | +* [`css/highlightjs-copy.min.css`](css/highlightjs-copy.min.css) |
| 57 | +* [`js/theme.js`](js/theme.js) |
| 58 | +* [`js/highlightjs.min.js`](js/highlightjs.min.js) |
80 | 59 | * [`js/highlightjs-copy.min.js`](js/highlightjs-copy.min.js) |
| 60 | + |
| 61 | +You can override these locally to style the color scheme, the typography & layout, or to adapt the `highlight.js` code highlighting. |
0 commit comments