sidebar-navigation-model

Sidebar Navigation Model

A modular and extensible JSON Schema for defining hierarchical sidebar navigation structures in content platforms, documentation tools, and UI frameworks.

Ideal for static site generators, developer portals, CMS integrations, or schema-driven UIs.

πŸ“˜ Overview

This repository contains a versioned specification for sidebar layout models. Built with composability and clarity in mind, the schema supports:

Whether you’re building a static site generator, documentation renderer, or a dynamic navigation engineβ€”this model is adaptable to your workflow.


πŸ“ Repository Structure

.
β”œβ”€β”€ README.md
β”œβ”€β”€ CHANGELOG.md
β”œβ”€β”€ package.json
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ definitions.md
β”‚   β”œβ”€β”€ integrations-guide.md
β”‚   └── overview.md
β”œβ”€β”€ schema/
β”‚   β”œβ”€β”€ v1.0.0/
β”‚   β”‚   β”œβ”€β”€ sidebar.schema.json
β”‚   β”‚   └── samples/
β”‚   β”‚       └── example.yaml
β”‚   └── latest/
β”‚       β”œβ”€β”€ sidebar.schema.json
β”‚       └── samples/
β”‚           └── example.yaml
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ yamlToMarkdown.js
β”‚   └── markdownToYaml.js

πŸ“˜ Features


πŸ› οΈ Conversion Scripts

yamlToMarkdown.js

Description:
Converts sidebar YAML files (matching the schema) into readable, structured Markdown navigation lists.
Supports preservation of YAML comments (before each sidebar entry) as Markdown paragraphs, and includes metadata such as the YAML filename and timestamp as Markdown comments.

Features:

Usage Example:

const fs = require('fs');
const { parseYamlWithSidebarComments, convertDataToMarkdown } = require('./scripts/yamlToMarkdown');

const yamlContent = fs.readFileSync('sidebars.yaml', 'utf8');
const data = parseYamlWithSidebarComments(yamlContent);

convertDataToMarkdown(data, { yamlFilePath: 'sidebars.yaml' }).then(markdown => {
  fs.writeFileSync('sidebars.md', markdown);
});

markdownToYaml.js

Description:
Converts Markdown navigation lists (as generated by yamlToMarkdown.js) back into YAML, reconstructing the sidebar structure and restoring comments as YAML comments.

Features:

Usage Example:

const fs = require('fs');
const { convertMarkdownToYaml } = require('./scripts/markdownToYaml');

const markdownContent = fs.readFileSync('sidebars.md', 'utf8');
const yaml = convertMarkdownToYaml(markdownContent, { markdownFilePath: 'sidebars.md' });
fs.writeFileSync('sidebars.generated.yaml', yaml);

🧩 Dependencies

Both scripts require the following libraries (see package.json):

Install all dependencies with:

npm install

πŸš€ Usage

Clone the repo:

git clone https://github.com/your-username/sidebar-navigation-model.git

πŸ“š Documentation

Explore:


πŸ“Œ Versioning

We follow Semantic Versioning for schema releases. Refer to the CHANGELOG.md for a history of changes.


🀝 Contributing

Contributions are welcome! See our contributing guide to get started.


πŸ“¬ Questions or Feedback?

Have a question or feedback? Please use one of the following channels:


πŸ“„ License

Released under the MIT License. Use it freely in commercial and open-source projects.