Quick start
Preparation
-
Install Node.js v22 or higher.
-
Install a text editor, such as VS Code.
-
Install the Diplodoc CLI package by running the command
npm i @diplodoc/cli -gin the terminal.
Creating a project
Using the command yfm init, you can create a project in the desired folder via the console.
A separate page describes the project initialization parameters.
You can use the test project template from our repository.
Warning
Fork the template repository to quickly deploy your documentation:
-
On the template page, next to the title, click the Fork button. The Create a new fork page will open.
-
Click Create fork. A repository with a ready-made project structure will be created in your GitHub profile.
-
Clone the created repository to your computer.
Project structure
doc-folder
|-- .yfm # Файл конфигурации
|-- toc.yaml # Оглавление
|-- index.md # Разводящая страница
|-- content-page.md # Страница с контентом
- Configuration file .yfm.
- Leading page.
- Pages with content.
- Table of contents file toc.yaml.
For more details about parameters and configuration, see the section Documentation project.
Building a project
The build is performed using the yfm console utility and the command yfm build.
To build the project, run the command:
yfm build -i ./doc-folder -o ./output-folder
Where:
-i— path to the project directory (for example, the folder you cloned).-o— path to the directory where static HTML files will be saved.
After successful execution, a folder with the ready HTML project will appear.
Running a local server
To view the build result in a browser, use a local web server.
-
Build the project:
yfm build -i ./doc-folder -o ./output-folderTip
Use watch mode. To do this, add the flag
--watchso that changes are immediately reflected in the local build.yfm build -i ./doc-folder -o ./output-folder --watch -
Run a server for the folder with the build result using the package
http-server:npx http-server ./output-folder -p 5005
The documentation will be available at http://localhost:5005.
Publishing on GitHub Pages
-
Go to your documentation repository on GitHub, open the Settings tab, and select Pages in the left menu.
-
In the Build and deployment section, select GitHub Actions from the dropdown list.
-
In the appeared block Static HTML, click Configure. The GitHub Actions window will open.
-
In the
workflowfile, find thejobsblock and after the lineuses: actions/configure-pages@v5add:- name: Build docs uses: diplodoc-platform/docs-build-static-action@v1 with: src-root: './docs' build-root: './docs-html' -
In the same file, find the
Upload artifactstep and change the path to the directory with the built documentation:- name: Upload artifact uses: actions/upload-pages-artifact@v3 with: path: './docs-html' -
In the upper-right corner, click Commit changes..., in the Commit message field specify the commit message and click Commit changes.
-
Go to the Actions tab. At the top of the list, you will see your latest commit.
-
Click on the commit name. After the build completes, the document will be published on GitHub Pages. You can view it via the link below under the deploy label.
Publishing on diplodoc.com
Warning
-
Go to the website diplodoc.com and click the Start button.
-
Follow the instructions provided on the page.
-
On your GitHub page, a repository
diplodoc-examplewill be automatically created and a link to the documentation example will be generated.
Note
To change the default repository name diplodoc-example, contact us.