Changemaker/code-server-mkdocs.md

2.0 KiB

MkDocs in Code-Server

This setup allows you to edit and manage your MkDocs site directly within the Code-Server web IDE.

Available Commands

The MkDocs-Material package has been installed in a virtual environment with all required dependencies, including imaging support for the social plugin. You can use the following commands in the terminal inside code-server:

Basic usage

# Run mkdocs commands directly
mkdocs --help
mkdocs build
mkdocs serve --dev-addr=0.0.0.0:8000

# Or use the convenience script that automatically changes to the mkdocs directory
run-mkdocs --help
run-mkdocs build
run-mkdocs serve --dev-addr=0.0.0.0:8000

Installed MkDocs Extensions

The following MkDocs plugins and extensions are pre-installed:

  • mkdocs-material (with imaging support)
  • mkdocs-minify-plugin
  • mkdocs-git-revision-date-localized-plugin
  • mkdocs-glightbox
  • mkdocs-redirects

Installing Additional Plugins

To install additional MkDocs plugins or dependencies:

# Install additional MkDocs plugins
pip install <plugin-name>

# For example, to install another plugin
pip install mkdocs-awesome-pages-plugin

Folder Structure

  • /home/coder/mkdocs - Your MkDocs project directory (shared with the mkdocs container)
  • /home/coder/.venv/mkdocs/bin - Contains the Python virtual environment with mkdocs
  • /home/coder/.local/bin - Contains the run-mkdocs convenience script

Tips

  1. When running mkdocs serve inside code-server, use --dev-addr=0.0.0.0:8000 to make it accessible.
  2. The mkdocs container is still available and running in parallel if needed.
  3. You can use the VS Code file explorer to easily navigate and edit your MkDocs files.
  4. Use the Code-OSS Markdown Preview feature to preview your markdown files as you edit them.

Tips

  1. When running mkdocs serve inside code-server, use --dev-addr=0.0.0.0:8000 to make it accessible.
  2. The mkdocs container is still available and running in parallel if needed.
  3. You can use the VS Code file explorer to easily navigate and edit your MkDocs files.