Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 7ec59ff
Author: Azzedine E. <[email protected]>
Date:   Fri Nov 22 20:48:07 2024 +0100

    Update README.md

commit 747c5f2
Author: Azzedine E. <[email protected]>
Date:   Thu Nov 21 21:46:57 2024 +0100

    refactor: update id from nodes

commit c2f3ca5
Author: Azzedine E. <[email protected]>
Date:   Thu Nov 21 21:15:14 2024 +0100

    refactor: add devlopment mode

commit 7f9d6e6
Author: Azzedine E. <[email protected]>
Date:   Thu Nov 21 20:51:18 2024 +0100

    refactor: add tad parameters

commit f44997b
Author: Azzedine E. <[email protected]>
Date:   Thu Nov 21 20:35:34 2024 +0100

    refactor: rename categories to sources

commit dea1814
Author: Azzedine E. <[email protected]>
Date:   Thu Nov 21 20:29:52 2024 +0100

    refactor: names params

commit ac5feaa
Author: Azzedine E. <[email protected]>
Date:   Thu Nov 21 19:37:44 2024 +0100

    refactor: update params plugin

    - add build path

commit fde2478
Author: Azzedine E. <[email protected]>
Date:   Thu Nov 21 18:52:05 2024 +0100

    refactor: title is name of file when no header

commit 54cd175
Author: Azzedine E. <[email protected]>
Date:   Thu Nov 21 18:19:17 2024 +0100

    refactor: mdUtils
  • Loading branch information
Arsero committed Nov 22, 2024
1 parent 1d4008c commit 97854e5
Show file tree
Hide file tree
Showing 21 changed files with 448 additions and 431 deletions.
96 changes: 18 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,31 +77,10 @@ yarn add docusaurus-graph
```js
module.exports = {
// Other Docusaurus configurations...
plugins: [
[
'docusaurus-graph',
{
path: 'docs', // Specify the folder of your documentation
},
],
],
plugins: ['docusaurus-graph'],
};
```

> The default path is `docs`.
3. Build the project to create the data file.

```sh
npm run build
```

or

```sh
yarn build
```

## Usage

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.
Expand All @@ -123,47 +102,34 @@ module.exports = {
[
'docusaurus-graph',
{
path: 'docs', // Specify the folder of your documentation
docsDir: "docs",
buildDir: "build",
sourcesTag: "sources",
referencesTag: "references",
},
],
],
};
```

- `path`: (default: `docs`) The folder containing your documentation files.
- `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.

### Markdown files

To create link between files, there are 2 tags :

#### Categories

Set the categories tag to a markdown file or a name (a file that doesn't exist). Example:

To a markdown file (intro.md):

```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**!
```
#### Sources

To a name:
Set the categories tag to a markdown file or a name. Example:

```md
## [comment]: <> (congratulations.md)

sidebar_position: 6
categories: tutorial-basics
sources: tutorial-basics

---

Expand All @@ -174,7 +140,7 @@ You have just learned the **basics of Docusaurus** and made some changes to the
Docusaurus has **much more to offer**!
```

Result :
**Result :**

<p align="center">
<img src="assets/CongratulationCategories.png" alt="graphview">
Expand All @@ -186,7 +152,7 @@ Result :
## [comment]: <> (congratulations.md)

sidebar_position: 6
categories:
sources:

- intro
- tutorial-basics
Expand All @@ -196,33 +162,7 @@ categories:

#### References

Set the references tag to a markdown file or a name (a file that doesn't exist). Example:

To a markdown file (intro.md):

```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:
Set the references tag to a markdown file or a name. Example:

```md
## [comment]: <> (congratulations.md)
Expand All @@ -239,22 +179,22 @@ You have just learned the **basics of Docusaurus** and made some changes to the
Docusaurus has **much more to offer**!
```

Result :
**Result :**

<p align="center">
<img src="assets/CongratulationReferences.png" alt="graphview">
</p>

## How it works

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:
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). The file is created in the `build` directory of your Docusaurus project.
> 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).
## Development

Expand Down
2 changes: 1 addition & 1 deletion demo/docs/tutorial-basics/congratulations.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 6
categories: tutorial-extras
sources: tutorial-extras
references: tutorial-basics
---

Expand Down
3 changes: 2 additions & 1 deletion demo/docs/tutorial-basics/create-a-blog-post.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebar_position: 3
categories: tutorial-basics
sources: tutorial-basics
references: create-a-page
---

# Create a Blog Post
Expand Down
14 changes: 7 additions & 7 deletions demo/docs/tutorial-basics/create-a-document.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 2
categories: tutorial-basics
sources: tutorial-basics
---

# Create a Document
Expand Down Expand Up @@ -31,7 +31,7 @@ Add metadata to customize the sidebar label and position:

```md title="docs/hello.md" {1-4}
---
sidebar_label: 'Hi!'
sidebar_label: "Hi!"
sidebar_position: 3
---

Expand All @@ -45,13 +45,13 @@ It is also possible to create your sidebar explicitly in `sidebars.js`:
```js title="sidebars.js"
export default {
tutorialSidebar: [
'intro',
"intro",
// highlight-next-line
'hello',
"hello",
{
type: 'category',
label: 'Tutorial',
items: ['tutorial-basics/create-a-document'],
type: "category",
label: "Tutorial",
items: ["tutorial-basics/create-a-document"],
},
],
};
Expand Down
6 changes: 3 additions & 3 deletions demo/docs/tutorial-basics/create-a-page.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 1
categories: tutorial-basics
sources: tutorial-basics
---

# Create a Page
Expand All @@ -16,8 +16,8 @@ Add **Markdown or React** files to `src/pages` to create a **standalone page**:
Create a file at `src/pages/my-react-page.js`:

```jsx title="src/pages/my-react-page.js"
import React from 'react';
import Layout from '@theme/Layout';
import React from "react";
import Layout from "@theme/Layout";

export default function MyReactPage() {
return (
Expand Down
2 changes: 1 addition & 1 deletion demo/docs/tutorial-basics/deploy-your-site.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 5
categories: tutorial-basics
sources: tutorial-basics
references: tutorial-extras
---

Expand Down
4 changes: 2 additions & 2 deletions demo/docs/tutorial-extras/manage-docs-versions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 1
categories: tutorial-extras
sources: tutorial-extras
---

# Manage Docs Versions
Expand Down Expand Up @@ -35,7 +35,7 @@ export default {
items: [
// highlight-start
{
type: 'docsVersionDropdown',
type: "docsVersionDropdown",
},
// highlight-end
],
Expand Down
8 changes: 4 additions & 4 deletions demo/docs/tutorial-extras/translate-your-site.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 2
categories: tutorial-extras
sources: tutorial-extras
references: tutorial-basics
---

Expand All @@ -15,8 +15,8 @@ Modify `docusaurus.config.js` to add support for the `fr` locale:
```js title="docusaurus.config.js"
export default {
i18n: {
defaultLocale: 'en',
locales: ['en', 'fr'],
defaultLocale: "en",
locales: ["en", "fr"],
},
};
```
Expand Down Expand Up @@ -62,7 +62,7 @@ export default {
items: [
// highlight-start
{
type: 'localeDropdown',
type: "localeDropdown",
},
// highlight-end
],
Expand Down
Loading

0 comments on commit 97854e5

Please sign in to comment.