Skip to content

Commit 777eb1a

Browse files
Docusaurus basics (#11752)
Not a lot of info here, but probably worth pushing out anyway <!-- readthedocs-preview docs start --> --- :books: Documentation previews :books: - User's documentation (`docs`): https://docs--11752.org.readthedocs.build/en/11752/ <!-- readthedocs-preview docs end --> <!-- readthedocs-preview dev start --> - Developer's documentation (`dev`): https://dev--11752.org.readthedocs.build/en/11752/ <!-- readthedocs-preview dev end --> --------- Co-authored-by: Eric Holscher <[email protected]> Co-authored-by: Eric Holscher <[email protected]>
1 parent 28d0f13 commit 777eb1a

File tree

4 files changed

+109
-12
lines changed

4 files changed

+109
-12
lines changed

docs/user/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Read the Docs: documentation simplified
1010
/intro/doctools
1111
/intro/mkdocs
1212
/intro/sphinx
13+
/intro/docusaurus
1314
/intro/markdoc
1415
/intro/add-project
1516
/examples

docs/user/intro/doctools.rst

+10
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ with more coming soon.
3030
Written in
3131
:bdg-info:`python`
3232

33+
.. grid-item-card:: Docusarus
34+
:link: docusaurus.html
35+
36+
Docusaurus is a static-site generator that builds a single-page application with fast client-side navigation and out-of-the-box documentation features.
37+
38+
Supported formats
39+
:bdg-success:`mdx` :bdg-success:`md`
40+
Written in
41+
:bdg-info:`React`
42+
3343
.. grid-item-card:: Markdoc
3444
:link: markdoc.html
3545

docs/user/intro/docusaurus.rst

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
2+
Docusarus
3+
=========
4+
5+
.. meta::
6+
:description lang=en: Hosting Docusaurus sites on Read the Docs.
7+
8+
`Docusaurus`_ is a static-site generator that builds a single-page application with fast client-side navigation and out-of-the-box documentation features.
9+
10+
Minimal configuration required to build a Docusaurus project on Read the Docs looks like this,
11+
specifying a nodejs toolchain on Ubuntu, using multiple :ref:`build <config-file/v2:build>` commands to install the requirements,
12+
build the site, and copy the output to $READTHEDOCS_OUTPUT:
13+
14+
.. code-block:: yaml
15+
:caption: .readthedocs.yaml
16+
17+
version: 2
18+
build:
19+
os: "ubuntu-22.04"
20+
tools:
21+
nodejs: "18"
22+
commands:
23+
# "docs/" was created following the Docusaurus tutorial:
24+
# npx create-docusaurus@latest docs classic
25+
# but you can just use your existing Docusaurus site
26+
#
27+
# Install Docusaurus dependencies
28+
- cd docs/ && npm install
29+
# Build the site
30+
- cd docs/ && npm run build
31+
# Copy generated files into Read the Docs directory
32+
- mkdir --parents $READTHEDOCS_OUTPUT/html/
33+
- cp --recursive docs/build/* $READTHEDOCS_OUTPUT/html/
34+
35+
.. _Docusaurus: https://docusaurus.io/
36+
37+
Limitations
38+
-----------
39+
40+
.. csv-table:: Limitations
41+
:header: "Feature", "Description", "Supported"
42+
43+
"Search", "Provides full-text search capabilities.", "Not supported"
44+
"Files changed", "Ability to see what HTML files changes in pull request previews", "Not supported"
45+
46+
47+
Quick start
48+
-----------
49+
50+
- If you have an existing Docusaurus project you want to host on Read the Docs, check out our :doc:`/intro/add-project` guide.
51+
52+
- If you're new to Docusaurus, check out the official `Fast Track`_ guide.
53+
54+
.. _Fast Track: https://docusaurus.io/docs#fast-track
55+
56+
Configuring Docusaurus and Read the Docs addons
57+
-----------------------------------------------
58+
59+
For optimal integration with Read the Docs, make the optional following configuration changes to your Docusaurus config.
60+
61+
.. contents::
62+
:depth: 1
63+
:local:
64+
:backlinks: none
65+
66+
Set the canonical URL
67+
~~~~~~~~~~~~~~~~~~~~~
68+
69+
A :doc:`canonical URL </canonical-urls>` allows you to specify the preferred version of a web page
70+
to prevent duplicated content.
71+
72+
Set your Docusaurus `url`_ to your Read the Docs canonical URL using `dotenv <https://www.npmjs.com/package/dotenv>`__ and a
73+
:doc:`Read the Docs environment variable </reference/environment-variables>`:
74+
75+
.. code-block:: js
76+
:caption: docusaurus.config.js
77+
78+
import 'dotenv/config';
79+
80+
export default {
81+
url: process.env.READTHEDOCS_CANONICAL_URL,
82+
};
83+
84+
.. _url: https://docusaurus.io/docs/configuration#syntax-to-declare-docusaurus-config
85+
86+
Example repository and demo
87+
---------------------------
88+
89+
Example repository
90+
https://github.com/readthedocs/test-builds/tree/docusaurus
91+
92+
Demo
93+
https://test-builds.readthedocs.io/en/docusaurus/

docs/user/intro/markdoc.rst

+5-12
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,11 @@ you need to generate static HTML from the Next JS build:
5959
...nextConfig,
6060
});
6161
62-
Supported features
63-
------------------
64-
65-
.. csv-table:: Supported features
66-
:header: "Feature", "Description", "Supported"
67-
68-
"Pull request previews", "Preview changes to your documentation before merging.", "✅"
69-
"Versioning", "Supports multiple versions of your documentation.", "✅"
70-
"Search", "Provides full-text search capabilities.", "✅"
71-
"Flyout menu", "Provides a flyout menu for navigation.", "✅"
72-
"Offline formats", "Generates PDF and EPUB formats.", "✅"
73-
"Localization", "Supports multiple languages.", "✅"
62+
Limitations
63+
-----------
64+
65+
All Read the Docs features are supported for Markdoc projects.
66+
There may be some Markdoc features that depend on server-side rendering that are not supported.
7467

7568
Getting started
7669
---------------

0 commit comments

Comments
 (0)