Getting Started with NCMDS
This comprehensive guide will take you from installation to creating your first professional documentation site with NCMDS.
π¦ Installation
System Requirements
Minimum Requirements: - Python 3.8 or higher (Python 3.11+ recommended) - pip package manager - 100 MB free disk space - Any modern web browser
For QMD Export (optional, requires Quarto CLI for rendering): - Install Quarto from quarto.org - NCMDS generates QMD files natively; Quarto renders them to PDF, HTML, or DOCX
Step-by-Step Installation
1. Clone the Repository
# Using HTTPS
git clone https://github.com/edujbarrios/ncmds.git
cd ncmds
# Or using SSH
git clone git@github.com:edujbarrios/ncmds.git
cd ncmds
2. Install Python Dependencies
# Install all required packages
pip install -r requirements.txt
# Or using virtual environment (recommended)
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On Linux/Mac:
source venv/bin/activate
# Then install dependencies
pip install -r requirements.txt
3. Verify Installation
# Check if all dependencies are installed
pip list | grep -E "Flask|markdown|PyYAML|Pygments"
# Should show:
# Flask==3.0.0
# Markdown==3.5.1
# PyYAML==6.0.1
# Pygments==2.17.2
4. Start the Server
python ncmds.py
You should see:
* Running on http://127.0.0.1:5000
* Press CTRL+C to quit
5. Access Your Documentation
Open your browser and navigate to:
- http://localhost:5000 - Your documentation homepage
- http://127.0.0.1:5000 - Alternative address (same server)
π Creating Your First Documentation
Understanding the docs/ Folder
All your Markdown files go in the docs/ directory. NCMDS automatically discovers and serves them.
Current structure:
docs/
βββ 01-index.md β Homepage
βββ 02-getting-started.md β This guide
βββ 03-configuration.md β Config guide
βββ 04-markdown-guide.md β Markdown reference
βββ 05-themes.md β Theme guide
βββ 06-deployment.md β Deploy guide
βββ 07-components.md β Component guide
Create Your First Page
Step 1: Create the File
Create docs/08-my-first-page.md with your text editor:
# My First Documentation Page
Welcome to my custom documentation!
## Introduction
This page demonstrates how easy it is to create documentation with NCMDS.
## Features I Love
- **Zero configuration** - Just write Markdown
- **Instant preview** - Refresh to see changes
- **Beautiful styling** - Professional look out of the box
## Code Example
```python
def greet(name):
"""A simple greeting function"""
return f"Hello, {name}! Welcome to NCMDS."
print(greet("World"))
What's Next?
Now I can add more pages, customize the theme, and even set up AI assistance!
#### Step 2: View Your Page
1. Save the file
2. Go to your browser
3. Refresh the page (`F5` or `Ctrl+R`)
4. Look in the sidebarβyour new page appears!
5. Click on "My First Page" to view it
**That's it!** No compilation, no build step, no webpack. Just write and refresh.
## π Document Ordering
Control the order of pages in the sidebar menu using three methods:
### Method 1: Numeric Prefix (Recommended)
Add a number prefix to your filename:
docs/ βββ 01-index.md # First βββ 02-getting-started.md # Second βββ 03-configuration.md # Third βββ 10-advanced.md # Fourth βββ 99-appendix.md # Last
**Benefits:**
- Easy to see order at a glance
- Simple to reorder (rename files)
- No need to edit file contents
### Method 2: YAML Frontmatter
Add metadata at the top of your `.md` file:
```markdown
---
order: 10
title: "Custom Page Title"
---
# My Document
Content starts here...
Options:
- order: Numeric value for sorting (lower numbers appear first)
- title: Override the filename for display in navigation
Method 3: Alphabetical (Default)
If no prefix or order metadata exists, files sort alphabetically:
docs/
βββ api-reference.md # First (A)
βββ deployment.md # Second (D)
βββ getting-started.md # Third (G)
βββ troubleshooting.md # Fourth (T)
π€ Exporting Documentation
NCMDS can export your documentation to QMD (Quarto Markdown) format, which you can then render to PDF, HTML, or DOCX using Quarto CLI.
Quick Export
To export documentation:
- Look in the sidebar for the Export Documentation button
- Click to download all documentation as a single QMD file
- Use Quarto CLI to render to your desired format
QMD Export Features
What you get: - Quarto Markdown files with YAML frontmatter - Ready to render with Quarto CLI - Preserves all Markdown formatting - Configurable output formats (PDF, HTML, DOCX)
How to use QMD files:
# Install Quarto (if not already installed)
# Download from https://quarto.org/docs/get-started/
# Render to PDF
quarto render document.qmd --to pdf
# Render to HTML
quarto render document.qmd --to html
# Render to Word
quarto render document.qmd --to docx
Configure Export Settings
Edit config/config.yaml:
export:
show_on_all_pages: true # Show export buttons on all pages
qmd:
enabled: true
button_text: "Export Documentation"
project_name: "" # Leave empty to use site_name
default_format: "pdf" # Options: pdf, html, docx
π‘ Best Practices
Follow these guidelines for excellent documentation:
Writing Guidelines
1. Clear Titles - Use descriptive, specific titles - Start with action verbs: "Installing", "Configuring", "Deploying" - Avoid vague titles like "Info" or "Stuff"
2. Structure Content
# Main Topic (H1 - once per page)
Brief introduction explaining what this page covers.
## Section (H2)
Main content sections.
### Subsection (H3)
Detailed topics within sections.
#### Detail (H4)
Specific details or examples.
3. Use Examples Liberally - Code examples for every feature - Screenshots where helpful - Before/after comparisons - Real-world use cases
4. Keep Pages Focused - One topic per page - Break large topics into multiple pages - Link related pages together
5. Test Your Docs - Read them with fresh eyes - Have someone else review them - Check all links and code examples
File Organization
For small sites (< 20 pages):
docs/
βββ 01-index.md
βββ 02-installation.md
βββ 03-usage.md
βββ 04-api-reference.md
For medium sites (20-50 pages):
docs/
βββ 01-index.md
βββ 02-getting-started.md
βββ 10-user-guide.md
βββ 11-basic-usage.md
βββ 12-advanced-features.md
βββ 20-api-reference.md
βββ 21-api-endpoints.md
βββ 30-deployment.md
For large sites (50+ pages): Consider organizing by folders (coming soon) or using gaps in numbering:
docs/
βββ 01-index.md
βββ 10-introduction.md
βββ 20-installation.md
βββ 30-tutorials.md
βββ 31-tutorial-basics.md
βββ 32-tutorial-advanced.md
βββ 40-guides.md
βββ 41-guide-authentication.md
βββ 50-api-reference.md
βββ 90-troubleshooting.md
π Project Structure Explained
Understanding NCMDS file organization:
ncmds/
βββ ncmds.py # Main application entry point
βββ pyproject.toml # Project metadata and build config
βββ requirements.txt # Python dependencies
βββ runtime.txt # Python version (for Vercel/Heroku)
βββ vercel.json # Vercel deployment config
βββ .env.example # Environment variables template
βββ README.md # Project README
β
βββ api/ # Vercel serverless entry point
β βββ index.py # Imports and exports the Flask app
β
βββ config/ # Configuration files
β βββ __init__.py # Config package exports
β βββ config.yaml # Main site configuration
β βββ settings.py # ConfigManager & ThemeLoader
β
βββ docs/ # YOUR DOCUMENTATION GOES HERE
β βββ 01-index.md # Homepage
β βββ *.md # Your Markdown files
β
βββ templates/ # HTML templates (Jinja2)
β βββ layout.html # Base page layout
β βββ home.html # Hero landing page
β βββ components/ # Reusable components
β βββ html/ # HTML template components
β β βββ head.html # Meta tags, CSS, theme variables
β β βββ header.html # Site header with toggles
β β βββ sidebar.html # Navigation sidebar
β β βββ toc.html # Table of contents
β β βββ doc_navigation.html # Prev/Next buttons
β β βββ footer.html # Site footer
β β βββ ai_chat.html # AI chat widget
β β βββ export_buttons.html # QMD export button
β β βββ text_to_speech_button.html # Read aloud button
β βββ scripts/ # JavaScript components
β βββ scripts.html # Theme toggle, copy buttons, etc.
β
βββ static/ # Static assets
β βββ main.css # Main CSS entry point (imports modules)
β βββ style.css # Legacy stylesheet (backup)
β βββ ai_chat.css # AI chat widget styles
β βββ ai_chat.js # AI chat widget logic
β βββ search.js # Full-text search implementation
β βββ default_theme/ # Modular CSS files
β β βββ base.css # Reset & typography
β β βββ header.css # Header styles
β β βββ hero.css # Hero section styles
β β βββ sidebar.css # Sidebar styles
β β βββ toc.css # Table of contents styles
β β βββ content.css # Main content & markdown
β β βββ code.css # Code blocks & syntax highlighting
β β βββ navigation.css # Navigation & footer
β β βββ search.css # Search styles
β β βββ responsive.css # Media queries
β β βββ utilities.css # Utility classes
β βββ images/ # Static images (logo, etc.)
β
βββ export/ # Export functionality
β βββ __init__.py # Export package exports
β βββ qmd_export.py # QMD generation (QMDExporter class)
β βββ export_routes.py # Export API routes
β
βββ ai_chat/ # AI chat functionality
β βββ __init__.py # AI chat package exports
β βββ llm_client.py # LLM API client (LLMClient class)
β βββ routes.py # Chat API routes
β
βββ utils/ # Utility modules
β βββ math_render.py # LaTeX math rendering
β
βββ images/ # Project images (screenshots, etc.)
What You Should Edit
Always edit:
- config/config.yaml - Your site settings
- docs/*.md - Your documentation content
Sometimes edit:
- templates/ - If customizing HTML structure
- static/main.css or static/default_theme/ - If customizing styles
- .env.example - If adding new environment variables
Rarely edit:
- ncmds.py - Only if adding core features
- export/ or ai_chat/ - Only if modifying these features
π Next Steps
Now that you understand the basics:
- Configure Your Site - Set up site name, theme, AI chat
- Learn Markdown - Master all supported Markdown features
- Customize Themes - Create your own color scheme
- Deploy to Production - Share your docs with the world
π Getting Help
If you encounter issues:
- Check the documentation (you're reading it!)
- Look at example
.mdfiles indocs/ - Review
config/config.yamlfor configuration options - Open an issue on GitHub
Common issues and solutions:
Server won't start:
# Check if dependencies are installed
pip install -r requirements.txt
# Check if port 5000 is already in use
# Change port in config.yaml if needed
Page doesn't appear:
- Ensure file has .md extension
- Check file is in docs/ directory
- Refresh browser (Ctrl+R or F5)
- Check terminal for errors
Export buttons don't appear:
- Check export.show_on_all_pages: true in config
- Check export.qmd.enabled: true in config
- Check browser console for JavaScript errors
π§ Next Steps
- Learn about Configuration
- Explore Markdown Features
- Customize Themes
- Understand Template Components
- Learn about Deployment