Skip to content

Commit e9316be

Browse files
Add mdbook docs page (#11849)
This shows how to host docs with mdbook. Requires #11848 to not need a reshim (example: https://github.com/readthedocs/test-builds/blob/mdbook/.readthedocs.yaml#L10) <!-- readthedocs-preview docs start --> --- :books: Documentation previews :books: - User's documentation (`docs`): https://docs--11849.org.readthedocs.build/en/11849/ <!-- readthedocs-preview docs end --> <!-- readthedocs-preview dev start --> - Developer's documentation (`dev`): https://dev--11849.org.readthedocs.build/en/11849/ <!-- readthedocs-preview dev end --> --------- Co-authored-by: Manuel Kaufmann <[email protected]>
1 parent 3a0cac0 commit e9316be

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed

docs/user/intro/doctools.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,21 @@ Below is a list of popular documentation tools that you can use to write your do
5555
Written in
5656
:bdg-info:`javascript`
5757

58+
.. grid-item-card:: mdBook
59+
:link: mdbook.html
60+
61+
mdBook is a command line tool to create books with Markdown built in Rust.
62+
63+
Supported formats
64+
:bdg-success:`md`
65+
Written in
66+
:bdg-info:`rust`
67+
5868
.. toctree::
5969
:hidden:
6070

6171
/intro/mkdocs
6272
/intro/sphinx
6373
/intro/docusaurus
6474
/intro/markdoc
75+
/intro/mdbook

docs/user/intro/mdbook.rst

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
mdBook
2+
======
3+
4+
.. meta::
5+
:description lang=en: Learn how to host mdBook documentation on Read the Docs.
6+
7+
`mdBook`_ is a command line tool to create books with Markdown.
8+
9+
Minimal configuration is required to build an existing mdBook project on Read the Docs.
10+
11+
.. code-block:: yaml
12+
:caption: .readthedocs.yaml
13+
14+
version: 2
15+
16+
build:
17+
os: ubuntu-lts-latest
18+
tools:
19+
rust: latest
20+
commands:
21+
- cargo install mdbook
22+
# For an example book..
23+
# - mdbook init docs
24+
- mdbook build docs --dest-dir $READTHEDOCS_OUTPUT/html
25+
26+
.. _mdBook: https://rust-lang.github.io/mdBook/
27+
28+
Getting started
29+
---------------
30+
31+
- If you have an existing mdBook project you want to host on Read the Docs, check out our :doc:`/intro/add-project` guide.
32+
- If you're new to mdBook, check out the official `Getting started with mdBook`_ guide.
33+
34+
.. _Getting started with mdBook: https://rust-lang.github.io/mdBook/guide/creating.html
35+
36+
Configuring mdBook and Read the Docs Addons
37+
-------------------------------------------
38+
39+
Adjust the flyout menu font size
40+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41+
42+
Add a ``readthedocs.css`` to your build with the `additional-css <https://crisal.io/tmp/book-example/book/format/config.html#html-renderer-options>`_ flag,
43+
so that the font in the :ref:`flyout-menu:Addons flyout menu` matches the theme better.
44+
45+
.. code-block:: css
46+
:caption: readthedocs.css:
47+
48+
:root {
49+
/* Increase the font size of the flyout menu */
50+
--readthedocs-flyout-font-size: 1.3rem;
51+
52+
/* Increase the font size of the notifications */
53+
--readthedocs-notification-font-size: 1.3rem;
54+
55+
}
56+
57+
Example repository and demo
58+
---------------------------
59+
60+
Example repository
61+
https://github.com/readthedocs/test-builds/tree/mdbook
62+
63+
Demo
64+
https://test-builds.readthedocs.io/en/mdbook/
65+
66+
Further reading
67+
---------------
68+
69+
* `mdBook documentation`_
70+
71+
.. _mdBook documentation: https://rust-lang.github.io/mdBook/

docs/user/intro/mkdocs.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ To integrate the :ref:`flyout-menu:Addons flyout menu` version menu into your si
161161
Adjust the flyout menu font size
162162
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163163

164-
Edit ``readthedocs.css`` to so that the font in the :ref:`flyout-menu:Addons flyout menu` matches the theme better.
164+
Add a ``readthedocs.css`` to your build,
165+
so that the font in the :ref:`flyout-menu:Addons flyout menu` matches the theme better.
165166

166167
.. code-block:: css
167168
:caption: readthedocs.css:

0 commit comments

Comments
 (0)