Skip to content

Commit

Permalink
Add mdbook docs page (#11849)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ericholscher and humitos authored Dec 17, 2024
1 parent 3a0cac0 commit e9316be
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/user/intro/doctools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,21 @@ Below is a list of popular documentation tools that you can use to write your do
Written in
:bdg-info:`javascript`

.. grid-item-card:: mdBook
:link: mdbook.html

mdBook is a command line tool to create books with Markdown built in Rust.

Supported formats
:bdg-success:`md`
Written in
:bdg-info:`rust`

.. toctree::
:hidden:

/intro/mkdocs
/intro/sphinx
/intro/docusaurus
/intro/markdoc
/intro/mdbook
71 changes: 71 additions & 0 deletions docs/user/intro/mdbook.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
mdBook
======

.. meta::
:description lang=en: Learn how to host mdBook documentation on Read the Docs.

`mdBook`_ is a command line tool to create books with Markdown.

Minimal configuration is required to build an existing mdBook project on Read the Docs.

.. code-block:: yaml
:caption: .readthedocs.yaml
version: 2
build:
os: ubuntu-lts-latest
tools:
rust: latest
commands:
- cargo install mdbook
# For an example book..
# - mdbook init docs
- mdbook build docs --dest-dir $READTHEDOCS_OUTPUT/html
.. _mdBook: https://rust-lang.github.io/mdBook/

Getting started
---------------

- If you have an existing mdBook project you want to host on Read the Docs, check out our :doc:`/intro/add-project` guide.
- If you're new to mdBook, check out the official `Getting started with mdBook`_ guide.

.. _Getting started with mdBook: https://rust-lang.github.io/mdBook/guide/creating.html

Configuring mdBook and Read the Docs Addons
-------------------------------------------

Adjust the flyout menu font size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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,
so that the font in the :ref:`flyout-menu:Addons flyout menu` matches the theme better.

.. code-block:: css
:caption: readthedocs.css:
:root {
/* Increase the font size of the flyout menu */
--readthedocs-flyout-font-size: 1.3rem;
/* Increase the font size of the notifications */
--readthedocs-notification-font-size: 1.3rem;
}
Example repository and demo
---------------------------

Example repository
https://github.com/readthedocs/test-builds/tree/mdbook

Demo
https://test-builds.readthedocs.io/en/mdbook/

Further reading
---------------

* `mdBook documentation`_

.. _mdBook documentation: https://rust-lang.github.io/mdBook/
3 changes: 2 additions & 1 deletion docs/user/intro/mkdocs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ To integrate the :ref:`flyout-menu:Addons flyout menu` version menu into your si
Adjust the flyout menu font size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

.. code-block:: css
:caption: readthedocs.css:
Expand Down

0 comments on commit e9316be

Please sign in to comment.