-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add Markdoc to the doc tools #11782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add Markdoc to the doc tools #11782
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b6254f7
Add Markdoc to the doc tools
ericholscher 0f184f9
Add to toctree
ericholscher 671dc08
Apply suggestions from code review
ericholscher 7f67d21
Update docs/user/intro/markdoc.rst
ericholscher 6be07b5
Update docs/user/intro/markdoc.rst
ericholscher 31732c1
Update docs/user/intro/markdoc.rst
ericholscher 2d1df13
Update docs/user/intro/markdoc.rst
ericholscher 12bb32b
Update docs/user/intro/markdoc.rst
ericholscher e016dd9
Add Supported Features
ericholscher 0234608
Fix whitespace
ericholscher a729ada
Apply suggestions from code review
ericholscher 7bb66e4
Review feedback
ericholscher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
Markdoc | ||
======= | ||
|
||
.. meta:: | ||
:description lang=en: Hosting Markdoc documentation on Read the Docs. | ||
|
||
`Markdoc`_ is a powerful documentation framework that allows you to write documentation in a flavor of Markdown. | ||
|
||
Minimal configuration is required to build an existing Markdoc project on Read the Docs. | ||
|
||
.. code-block:: yaml | ||
:caption: .readthedocs.yaml | ||
|
||
version: 2 | ||
|
||
build: | ||
os: ubuntu-24.04 | ||
tools: | ||
nodejs: "22" | ||
commands: | ||
# Install dependencies | ||
- cd docs/ && npm install | ||
# Build the site | ||
- cd docs/ && npm run build | ||
# Copy generated files into Read the Docs directory | ||
- mkdir --parents $READTHEDOCS_OUTPUT/html/ | ||
- cp --verbose --recursive docs/out/* $READTHEDOCS_OUTPUT/html/ | ||
|
||
.. _Markdoc: https://markdoc.io/ | ||
|
||
Example configuration | ||
--------------------- | ||
|
||
In order to build a Markdoc project on Read the Docs, | ||
you need to generate static HTML from the Next JS build: | ||
|
||
.. code-block:: js | ||
:caption: next.config.js | ||
|
||
const withMarkdoc = require('@markdoc/next.js'); | ||
|
||
const nextConfig = { | ||
// Optional: Export HTML files instead of a Node.js server | ||
output: 'export', | ||
|
||
// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html` | ||
trailingSlash: true, | ||
|
||
// Use Canonical URL, but only the path and with no trailing / | ||
basePath: process.env.READTHEDOCS_CANONICAL_URL | ||
? new URL(process.env.READTHEDOCS_CANONICAL_URL).pathname.replace(/\/$/, "") | ||
: "", | ||
} | ||
|
||
module.exports = | ||
withMarkdoc({mode: 'static'})({ | ||
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdoc'], | ||
...nextConfig, | ||
}); | ||
|
||
Supported Features | ||
ericholscher marked this conversation as resolved.
Show resolved
Hide resolved
ericholscher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
------------------ | ||
|
||
.. csv-table:: Supported Features | ||
ericholscher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
:header: "Feature", "Description", "Supported" | ||
|
||
"Pull request previews", "Preview changes to your documentation before merging.", "✅" | ||
"Versioning", "Supports multiple versions of your documentation.", "✅" | ||
"Search", "Provides full-text search capabilities.", "✅" | ||
"Flyout menu", "Provides a flyout menu for navigation.", "✅" | ||
"Offline formats", "Generates PDF and ePub formats.", "❌" | ||
ericholscher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"Localization", "Supports multiple languages.", "❌" | ||
|
||
Getting started | ||
--------------- | ||
|
||
- If you have an existing Markdoc project you want to host on Read the Docs, check out our :doc:`/intro/add-project` guide. | ||
- If you're new to Markdoc, check out the official `Getting started with Markdoc`_ guide. | ||
|
||
.. _Getting started with Markdoc: https://markdoc.io/docs/getting-started | ||
|
||
Example repository and demo | ||
--------------------------- | ||
|
||
Example repository | ||
https://github.com/readthedocs/test-builds/tree/markdoc | ||
|
||
Demo | ||
https://test-builds.readthedocs.io/en/markdoc/ | ||
|
||
Further reading | ||
--------------- | ||
|
||
* `Markdoc documentation`_ | ||
|
||
.. _Markdoc documentation: https://markdoc.io/docs |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.