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'],
};
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',
{
docsDir: "docs",
buildDir: "build",
sourcesTag: "sources",
referencesTag: "references",
},
],
],
};
docsDir [default: docs]
: Specifies the path of the folder containing your documentation files.buildDir [default: build]
: Specifies the path of the output build folder.sourcesTag [default: sources]
: Specifies the sources tag name for .md files.referencesTag [default: references]
: Specifies the references tag name for .md files.
To create link between files, there are 2 tags :
Set the categories tag to a markdown file or a name. Example:
## [comment]: <> (congratulations.md)
sidebar_position: 6
sources: 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
sources:
- intro
- tutorial-basics
---
Set the references tag to a markdown file or a name. Example:
## [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 docsDir
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).
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.