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
Copy file name to clipboardExpand all lines: docs/deployment.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ The high-level differences between these approaches are outlined in [](#deployme
23
23
:::{note} MyST was designed to be deployed as an application
24
24
Deploying MyST as an application has many benefits. For example, [performance enhancements](./accessibility-and-performance.md) (like pre-fetching for instant page-transitions, loading indicators, and smaller network payloads) and easier upgrades as new MyST versions are released.
25
25
26
-
The [default themes](website-templates.md#themes-bundled-with-myst) for MyST are designed to be MyST applications rather than static sites, but the core functionality is equally shared between the two options.
26
+
The [default themes](#default-web-themes) for MyST are designed to be MyST applications rather than static sites, but the core functionality is equally shared between the two options.
27
27
:::
28
28
29
29
% - Static deployments are MPA (each page own HTML document), SSG (rendered ahead of time)
Copy file name to clipboardExpand all lines: docs/website-style.md
+35-51Lines changed: 35 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,83 +11,67 @@ We're still building out custom CSS functionality with the MyST engine.
11
11
Follow and comment on the issues linked below to help us improve it!
12
12
:::
13
13
14
-
## Use content blocks
14
+
## Defining a Style Sheet
15
15
16
-
:::{warning} CSS class support is very limited
17
-
Currently, you can only use CSS classes that are pre-loaded by MyST from Tailwind CSS, or defined in the HTML theme (see below for examples of both).
18
-
See these issues to track some of this:
16
+
The [default MyST website themes](#default-web-themes) support bundling a custom [style-sheet](https://en.wikipedia.org/wiki/CSS). This can be used to introduce custom CSS styling to your website. To include a custom CSS file as part of your website build, you can define the @template-site-myst-book-theme-style option, e.g.
19
17
20
-
- Defining your own CSS classes: https://github.com/jupyter-book/mystmd/issues/857
21
-
- Load extra Tailwind CSS classes when they're used on a page: https://github.com/jupyter-book/mystmd/issues/1617
18
+
```{code} yaml
19
+
:filename: myst.yml
20
+
:linenos:
21
+
:emphasize-lines: 3
22
+
site:
23
+
options:
24
+
style: ./my-style.css
25
+
```
26
+
27
+
For example, the style-sheet could contain styling for `em` elements nested below a particular `text-gradient` class:
28
+
29
+
:::{literalinclude} public/style.css
22
30
:::
23
31
32
+
## Adding CSS Classes
33
+
34
+
The intended way to apply custom styling to your MyST website is to use CSS classes to connect your content to the style sheet. There are several ways to do this.
35
+
36
+
### Use content blocks
37
+
24
38
[Content blocks](../blocks.md) allow you to attach arbitrary metadata to chunks of content.
25
39
You can attach one or more CSS classes by defining a `class` attribute for a block.
26
40
For example the following:
27
41
28
-
```md
29
-
+++ {"class": "col-gutter-right"}
30
-
Right-styled
42
+
```{myst}
43
+
+++ {"class": "text-gradient"}
44
+
This is _emphasized_. This is not emphasized.
31
45
32
46
+++
33
47
34
-
Normal-styled
48
+
This is not emphasized.
35
49
```
36
50
37
-
Results in:
38
-
39
-
+++ {"class": "col-gutter-right"}
40
-
Right-styled
41
-
42
-
+++
43
-
44
-
Normal-styled
45
-
46
-
## Use `div` and `span` elements
51
+
### Use `div` and `span` elements
47
52
48
53
You can attach classes directly to [`div` and `span` elements](#div-and-span).
49
54
50
55
{myst:directive}`div` and {myst:role}`span` are analogous to their HTML counterparts. Unlike their directive/role, the HTML elements can also be given `style` options, e.g.
51
56
52
-
<divclass="col-gutter-right"style="font-weight: bold;">Here's my div</div>
57
+
```{myst}
58
+
<div class="text-gradient" style="font-weight: bold;">Here's my <em>div</em></div>
53
59
54
-
Here's some <spanclass="col-gutter-right"style="font-weight:bold;">Span</span> content
55
-
56
-
## Add CSS classes to directives
60
+
Here's some <span class="text-gradient" style="font-weight:bold;">span <em>styled</em></span> content
61
+
```
57
62
58
-
:::{note} Not all directives support the `:class:` option
59
-
If you wish to attach classes to a directive that doesn't seem to support it, please [open an issue](https://github.com/jupyter-book/mystmd/issues)
60
-
:::
63
+
### Add CSS classes to directives
61
64
62
65
Many directives and content blocks have a `:class:` option that can be used to add arbitrary CSS classes.
63
66
For example, below we add a CSS class to an admonition directive to snap it to the right:
64
67
65
-
````md
68
+
````{myst}
66
69
```{note}
67
-
:class: col-gutter-right
68
-
I'm on the right!
70
+
:class: text-gradient
71
+
I'm _very stylish_.
69
72
```
70
73
````
71
74
72
-
```{note}
73
-
:class: col-gutter-right
74
-
I'm on the right!
75
-
```
76
-
77
-
## Use the HTML theme grid system classes to position content
78
-
79
-
The HTML themes come with [a grid system of CSS classes](https://jupyter-book.github.io/myst-theme/?path=/docs/components-grid-system--docs).
80
-
You can use these to position content according to the link above.
81
-
82
-
## Use Tailwind CSS classes
83
-
84
-
:::{note} Provide feedback
85
-
This issue tracks loading extra Tailwind CSS classes when they're used on a page:
You can use any [Tailwind CSS class](https://tailwindcss.com/docs/installation) that's loaded on a page to style your content.
91
-
See the Tailwind documentation for examples of how to do this.
92
-
If a class seems to have no effect, it is likely not loaded on the page by MyST.
93
-
Currently, it's not possible to customize which classes are included on a page (see above for an issue tracking this).
77
+
The HTML themes come with [a grid system of CSS classes](https://jupyter-book.github.io/myst-theme/?path=/docs/components-grid-system--docs), which can be used out-of-the-box to position content.
Copy file name to clipboardExpand all lines: docs/website-templates.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ They are defined via the same templating system used for [static document export
11
11
For the remainder of this page, assume that "theme" and "template" mean the same thing.
12
12
:::
13
13
14
+
(default-web-themes)=
15
+
14
16
## Themes bundled with MyST
15
17
16
18
There are two templates for MyST websites, a `book-theme`, which is the default and is based loosely on Jupyter Book and an `article-theme` that is designed for scientific documents with supporting notebooks. The documentation for this site uses the `book-theme`. For a demonstration of the `article-theme`, you can see [an article on finite volume](https://simpeg.xyz/tle-finitevolume).
0 commit comments