Skip to content
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

Add vitepress doc page #11944

Merged
merged 6 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/user/intro/doctools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ Below is a list of popular documentation tools that you can use to write your do
Written in
:bdg-info:`rust`

.. grid-item-card:: VitePress
:link: vitepress.html

VitePress is a static site generator with a focus on performance and simplicity.
ericholscher marked this conversation as resolved.
Show resolved Hide resolved

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

.. toctree::
:hidden:

Expand All @@ -73,3 +83,4 @@ Below is a list of popular documentation tools that you can use to write your do
/intro/docusaurus
/intro/markdoc
/intro/mdbook
/intro/vitepress
83 changes: 83 additions & 0 deletions docs/user/intro/vitepress.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
VitePress
=========

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

`VitePress`_ is a static site generator with a focus on performance and simplicity.

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

.. code-block:: yaml
:caption: .readthedocs.yaml

version: 2

build:
os: ubuntu-lts-latest
ericholscher marked this conversation as resolved.
Show resolved Hide resolved
tools:
nodejs: "latest"
jobs:
install:
- npm install vitepress
build:
# The site was created by running `vitepress init`
# and following the official guide
# https://vitepress.dev/guide/getting-started
- vitepress build docs
ericholscher marked this conversation as resolved.
Show resolved Hide resolved
- mkdir -p $READTHEDOCS_OUTPUT/
- mv docs/.vitepress/dist $READTHEDOCS_OUTPUT/html
ericholscher marked this conversation as resolved.
Show resolved Hide resolved

.. _VitePress: https://vitepress.dev/

.. button-link:: https://dbtoolsbundle.readthedocs.io/en/stable/
:color: secondary

🔗 DbToolsBundle uses VitePress and Read the Docs
ericholscher marked this conversation as resolved.
Show resolved Hide resolved

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

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

.. _Getting started with VitePress: https://vitepress.vuejs.org/guide/getting-started.html

Using the proper basepath
-------------------------

To ensure that your VitePress site works correctly on Read the Docs,
you need to set the ``base`` option in your VitePress configuration to the correct base path:

.. code-block:: js
:caption: .vitepress/config.js

import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
// Use Canonical URL, but only the path and with no trailing /
// End result is like: `/en/latest`
base: process.env.READTHEDOCS_CANONICAL_URL
? new URL(process.env.READTHEDOCS_CANONICAL_URL).pathname.replace(/\/$/, "")
: "",

title: "My Awesome Project",
description: "A VitePress Site",
})

Example repository and demo
---------------------------

Example repository
https://github.com/readthedocs/test-builds/tree/vitepress
ericholscher marked this conversation as resolved.
Show resolved Hide resolved

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

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

* `VitePress documentation`_

.. _VitePress documentation: https://vitepress.dev/