Skip to content

Commit f0467df

Browse files
ericholscherhumitosagjohnson
authored
Add Markdoc to the doc tools (#11782)
This highlights the test-builds repo, and contains the basic config to make it build on RTD. This doesn't address any integration info, but I wanted to get a basic page up to start getting SEO. <!-- readthedocs-preview docs start --> --- :books: Documentation previews :books: - User's documentation (`docs`): https://docs--11782.org.readthedocs.build/en/11782/ <!-- readthedocs-preview docs end --> <!-- readthedocs-preview dev start --> - Developer's documentation (`dev`): https://dev--11782.org.readthedocs.build/en/11782/ <!-- readthedocs-preview dev end --> --------- Co-authored-by: Manuel Kaufmann <[email protected]> Co-authored-by: Anthony <[email protected]>
1 parent 6711656 commit f0467df

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
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/markdoc
1314
/intro/add-project
1415
/examples
1516

docs/user/intro/doctools.rst

+10
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,13 @@ with more coming soon.
2929
:bdg-success:`rst` :bdg-success:`md`
3030
Written in
3131
:bdg-info:`python`
32+
33+
.. grid-item-card:: Markdoc
34+
:link: markdoc.html
35+
36+
Markdoc is a documentation tool developed by Stripe that allows you to write documentation in a custom Markdown flavor.
37+
38+
Supported formats
39+
:bdg-success:`md`
40+
Written in
41+
:bdg-info:`javascript`

docs/user/intro/markdoc.rst

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
Markdoc
2+
=======
3+
4+
.. meta::
5+
:description lang=en: Hosting Markdoc documentation on Read the Docs.
6+
7+
`Markdoc`_ is a powerful documentation framework that allows you to write documentation in a flavor of Markdown.
8+
9+
Minimal configuration is required to build an existing Markdoc project on Read the Docs.
10+
11+
.. code-block:: yaml
12+
:caption: .readthedocs.yaml
13+
14+
version: 2
15+
16+
build:
17+
os: ubuntu-24.04
18+
tools:
19+
nodejs: "22"
20+
commands:
21+
# Install dependencies
22+
- cd docs/ && npm install
23+
# Build the site
24+
- cd docs/ && npm run build
25+
# Copy generated files into Read the Docs directory
26+
- mkdir --parents $READTHEDOCS_OUTPUT/html/
27+
- cp --verbose --recursive docs/out/* $READTHEDOCS_OUTPUT/html/
28+
29+
.. _Markdoc: https://markdoc.io/
30+
31+
Example configuration
32+
---------------------
33+
34+
In order to build a Markdoc project on Read the Docs,
35+
you need to generate static HTML from the Next JS build:
36+
37+
.. code-block:: js
38+
:caption: next.config.js
39+
40+
const withMarkdoc = require('@markdoc/next.js');
41+
42+
const nextConfig = {
43+
// Optional: Export HTML files instead of a Node.js server
44+
output: 'export',
45+
46+
// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html`
47+
trailingSlash: true,
48+
49+
// Use Canonical URL, but only the path and with no trailing /
50+
// End result is like: `/en/latest`
51+
basePath: process.env.READTHEDOCS_CANONICAL_URL
52+
? new URL(process.env.READTHEDOCS_CANONICAL_URL).pathname.replace(/\/$/, "")
53+
: "",
54+
}
55+
56+
module.exports =
57+
withMarkdoc({mode: 'static'})({
58+
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdoc'],
59+
...nextConfig,
60+
});
61+
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.", "✅"
74+
75+
Getting started
76+
---------------
77+
78+
- If you have an existing Markdoc project you want to host on Read the Docs, check out our :doc:`/intro/add-project` guide.
79+
- If you're new to Markdoc, check out the official `Getting started with Markdoc`_ guide.
80+
81+
.. _Getting started with Markdoc: https://markdoc.io/docs/getting-started
82+
83+
Example repository and demo
84+
---------------------------
85+
86+
Example repository
87+
https://github.com/readthedocs/test-builds/tree/markdoc
88+
89+
Demo
90+
https://test-builds.readthedocs.io/en/markdoc/
91+
92+
Further reading
93+
---------------
94+
95+
* `Markdoc documentation`_
96+
97+
.. _Markdoc documentation: https://markdoc.io/docs

0 commit comments

Comments
 (0)