Graphview docusaurus
The Docusaurus GraphView Plugin is an open source plugin designed to generate a graph view from your Docusaurus documentation files. This visual representation helps in understanding the relationships between different documents, making navigation and comprehension easier.
- Automatically generates a graph view from your documentation.
- Interactive and customizable graph visualization.
- Easy integration with your existing Docusaurus site.
To get a local copy up and running follow these next steps.
This project requires Node, yarn and git installed.
To install the plugin, you need to have Docusaurus set up. Follow these steps to add the GraphView plugin to your project:
- Install the plugin via npm or yarn:
npm install docusaurus-graph
or
yarn add docusaurus-graph
- Add the plugin to your Docusaurus site configuration (docusaurus.config.js):
module.exports = {
// Other Docusaurus configurations...
plugins: [
[
'docusaurus-graph',
{
path: 'docs', // Specify the folder of your documentation
},
],
],
};
The default path is
docs
.
- Build the project to create the data file.
npm run build
or
yarn build
Once the plugin is installed and configured, it will automatically generate a graph view of your documentation. You can access the graph view from a new button at the top right of your Docusaurus site.
The plugin supports one option to get the path folder.
Example configuration:
module.exports = {
// Other Docusaurus configurations...
plugins: [
[
'docusaurus-graph',
{
path: 'docs', // Specify the folder of your documentation
},
],
],
};
path
: (default:docs
) The folder containing your documentation files.
To create link between files, there are 2 tags :
Set the categories tag to a markdown file or a name (a file that doesn't exist). Example:
To a markdown file (intro.md):
## [comment]: <> (congratulations.md)
sidebar_position: 6
categories: intro
---
# Congratulations!
You have just learned the **basics of Docusaurus** and made some changes to the **initial template**.
Docusaurus has **much more to offer**!
To a name:
## [comment]: <> (congratulations.md)
sidebar_position: 6
categories: tutorial-basics
---
# Congratulations!
You have just learned the **basics of Docusaurus** and made some changes to the **initial template**.
Docusaurus has **much more to offer**!
Result :
To set multiple categories (or references) see this example :
## [comment]: <> (congratulations.md)
sidebar_position: 6
categories:
- intro
- tutorial-basics
---
Set the references tag to a markdown file or a name (a file that doesn't exist). Example:
To a markdown file (intro.md):
## [comment]: <> (congratulations.md)
sidebar_position: 6
references: intro
---
#### Differences
What's the difference between categories and references ?
See the categories like a parent or a chapter. Example : Car -> Engine.
The references is more like a child. Example : Wheel -> Car.
# Congratulations!
You have just learned the **basics of Docusaurus** and made some changes to the **initial template**.
Docusaurus has **much more to offer**!
To a name:
## [comment]: <> (congratulations.md)
sidebar_position: 6
references: tutorial-basics
---
# Congratulations!
You have just learned the **basics of Docusaurus** and made some changes to the **initial template**.
Docusaurus has **much more to offer**!
Result :
The Docusaurus GraphView Plugin works by parsing your Docusaurus documentation files located in the specified path
and creating a visual graph representation based on the relationships between them. Here’s a high-level overview of the process:
- File Parsing: The plugin scans the documentation files in your specified folder (path) to identify references between documents.
- Graph Construction: Using the parsed data, the plugin constructs a graph data structure where nodes represent documents and edges represent references between them.
- Graph Visualization: The constructed graph is then rendered using a graph visualization library (such as note-graph (D3.js)), applying the configured layout and styles.
- Interactive Elements: The generated graph is interactive, allowing users to zoom in/out and drag nodes for better viewing.
After the Docusaurus build process completes, the Docusaurus GraphView Plugin generates a data file containing the parsed documentation structure. This file, typically named
docusaurus-graph.json
, includes all the necessary information to construct the graph view, such as nodes (documents) and edges (links between documents). The file is created in thebuild
directory of your Docusaurus project.
If you want to contribute to the plugin or modify it for your own use, follow these steps:
- Clone the repository
git clone https://github.com/Arsero/docusaurus-graph.git
- Navigate to the project directory:
cd docusaurus-graph
- Install the dependencies:
yarn install
- Make your changes and test them locally. To test them go to the
demo
folder.
cd demo
yarn install
yarn start
The plugin is link to the
demo
project. The project is a simple docusaurus website with the plugin added.
We welcome contributions to the Docusaurus GraphView Plugin! If you have ideas, suggestions, or bug reports, please open an issue or submit a pull request. Follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Make your changes and commit them with clear and concise messages.
- Open a pull request to the main repository.
This project is licensed under the MIT License - see the LICENSE file for details.
- note-graph library used in this plugin.