Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MUYSC
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jorge Alfredo Jaimes Teherán
MUYSC
Commits
9057b331
Unverified
Commit
9057b331
authored
3 years ago
by
Sarah Brown
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
DOCS: document custom admonitions with css (#1507)
parent
b642a80d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/advanced/html.md
+37
-1
37 additions, 1 deletion
docs/advanced/html.md
with
37 additions
and
1 deletion
docs/advanced/html.md
+
37
−
1
View file @
9057b331
...
...
@@ -32,7 +32,7 @@ should overwrite pre-existing rules and behaviour.
### An example: justify the text
If you want the text of you book to be justified instead of left aligned then create
`myfile.css`
under
`mybook/_static`
with the following CSS:
If you want the text of you
r
book to be justified instead of left aligned then create
`myfile.css`
under
`mybook/_static`
with the following CSS:
```
css
p
{
...
...
@@ -40,6 +40,42 @@ p {
}
```
(custom-admonitions)=
### An Example: custom admonitions
:::{warning}
Styling custom admonitions in this way is not officially supported by Jupyter Book or Sphinx, so its behavior may change unexpectedly.
A more verbose but "stable" approach is to use the
`:class:`
keyword argument when creating your admonitions, and defining CSS rules for that class.
:::
Currently, using the
`{admonition}`
directive with a title creates a CSS class based on the title of the admonition.
For example, an admonition title of
`Here's my title`
will result in a class name of
`admonition-heres-my-title`
.
You can leverage this pattern to quickly create custom admonitions.
For example, create a
`myadmonitions.css`
under
`mybook/_static`
with the following CSS:
```
css
.admonition-extra-credit
{
border-left-color
:
rgba
(
0
,
246
,
16
,
1
);
}
.admonition-extra-credit
.admonition-title
{
background-color
:
rgba
(
0
,
246
,
16
,
.1
);
}
.admonition-extra-credit
.admonition-title
:before
{
color
:
rgba
(
0
,
246
,
16
,
1
);
content
:
'\f19d'
;
}
```
then in your book, define an admonition like so:
````
md
```
{admonition} Extra credit
An "extra credit" exercise is presented here.
```
````
The admonitions should be styled according to your CSS rules when you build your book.
## Enable Google Analytics
If you have a Google account, you can use Google Analytics to collect some
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment