or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/npm-minami

Clean and minimal JSDoc 3 Template / Theme for generating documentation websites

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/minami@1.2.x

To install, run

npx @tessl/cli install tessl/npm-minami@1.2.0

index.mddocs/

Minami

Minami is a clean, responsive documentation template theme for JSDoc 3 that generates professional-looking documentation websites from JSDoc comments. It provides a complete theming solution with modern typography, syntax highlighting, and responsive design.

Package Information

  • Package Name: minami
  • Package Type: npm
  • Language: JavaScript
  • Installation: npm install --save-dev minami

Core Imports

Minami is a JSDoc template, not a library to import. It's configured in JSDoc configuration files:

{
  "opts": {
    "template": "node_modules/minami"
  }
}

Basic Usage

Install and configure minami as your JSDoc template:

npm install --save-dev minami

Create a .jsdoc.json configuration file:

{
  "tags": {
    "allowUnknownTags": true,
    "dictionaries": ["jsdoc"]
  },
  "source": {
    "include": ["lib", "package.json", "README.md"],
    "includePattern": ".js$",
    "excludePattern": "(node_modules/|docs)"
  },
  "plugins": ["plugins/markdown"],
  "templates": {
    "cleverLinks": false,
    "monospaceLinks": true,
    "useLongnameInNav": false,
    "showInheritedInNav": true
  },
  "opts": {
    "destination": "./docs/",
    "encoding": "utf8",
    "private": true,
    "recurse": true,
    "template": "./node_modules/minami"
  }
}

Generate documentation:

npx jsdoc --configure .jsdoc.json --verbose

Architecture

Minami is structured as a JSDoc template with the following components:

  • Template Publisher: Main exports.publish function that processes JSDoc data
  • Template Files: HTML templates for different documentation sections
  • Static Assets: CSS styles, JavaScript utilities, and web fonts
  • Navigation Builder: Dynamic navigation generation based on doclet structure
  • Content Generators: Functions for creating individual documentation pages

Capabilities

JSDoc Template Publisher

Main entry point called by JSDoc to generate documentation from parsed doclets.

/**
 * Main JSDoc template publish function called by JSDoc to generate documentation
 * @param {TAFFY} taffyData - JSDoc data in TaffyDB format containing all doclets
 * @param {Object} opts - Template and JSDoc options including destination and encoding  
 * @param {Tutorial} tutorials - JSDoc tutorials data for generating tutorial pages
 */
exports.publish = function(taffyData, opts, tutorials);

This is the primary interface that JSDoc calls when using minami as a template. It processes all parsed documentation data and generates HTML files.

Template Configuration

Minami supports extensive configuration through JSDoc's template options.

interface TemplateOptions {
  /** Enable intelligent linking for references */
  cleverLinks?: boolean;
  /** Use monospace font for code links */
  monospaceLinks?: boolean;
  /** Show long names in navigation or max path elements to show */
  useLongnameInNav?: boolean | number;
  /** Show inherited members in navigation */
  showInheritedInNav?: boolean;
}

interface JsDocOptions {
  /** Output directory for generated documentation */
  destination: string;
  /** File encoding for generated files */
  encoding?: string;
  /** Include private members in documentation */
  private?: boolean;
  /** Recurse into subdirectories */
  recurse?: boolean;
  /** Path to template directory */
  template: string;
}

Template Assets

Minami includes comprehensive template and static assets for documentation generation.

interface TemplateAssets {
  /** HTML templates for different documentation sections */
  templates: {
    "layout.tmpl": "Main page layout template";
    "container.tmpl": "Container template for content sections";
    "mainpage.tmpl": "Homepage/index template";
    "members.tmpl": "Template for class/namespace members";
    "method.tmpl": "Template for function/method documentation";
    "properties.tmpl": "Template for property documentation";
    "params.tmpl": "Template for parameter documentation";
    "returns.tmpl": "Template for return value documentation";
    "details.tmpl": "Template for detailed information sections";
    "type.tmpl": "Template for type information";
    "examples.tmpl": "Template for code examples";
    "example.tmpl": "Template for individual example";
    "tutorial.tmpl": "Template for tutorial pages";
    "source.tmpl": "Template for source code display";
    "augments.tmpl": "Template for inheritance information";
    "exceptions.tmpl": "Template for exception documentation";
  };
  
  /** CSS stylesheets for documentation appearance */
  styles: {
    "jsdoc-default.css": "Main stylesheet for the template";
    "prettify-jsdoc.css": "Stylesheet for code syntax highlighting integration";
    "prettify-tomorrow.css": "Tomorrow theme for code highlighting";
  };
  
  /** JavaScript utilities for enhanced functionality */
  scripts: {
    "linenumber.js": "Script for adding line numbers to code blocks";
    "prettify.js": "Google Prettify library for syntax highlighting";
    "lang-css.js": "CSS language support for Prettify";
  };
  
  /** OpenSans font files in various formats */
  fonts: {
    "OpenSans-Regular-webfont.eot": "Regular weight EOT format";
    "OpenSans-Regular-webfont.woff": "Regular weight WOFF format";
    "OpenSans-Regular-webfont.svg": "Regular weight SVG format";
    "OpenSans-Bold-webfont.eot": "Bold weight EOT format";
    "OpenSans-Bold-webfont.woff": "Bold weight WOFF format";
    "OpenSans-Bold-webfont.svg": "Bold weight SVG format";
    "OpenSans-BoldItalic-webfont.eot": "Bold italic EOT format";
    "OpenSans-BoldItalic-webfont.woff": "Bold italic WOFF format";
    "OpenSans-BoldItalic-webfont.svg": "Bold italic SVG format";
    "OpenSans-Italic-webfont.eot": "Italic EOT format";
    "OpenSans-Italic-webfont.woff": "Italic WOFF format";
    "OpenSans-Italic-webfont.svg": "Italic SVG format";
    "OpenSans-Light-webfont.eot": "Light weight EOT format";
    "OpenSans-Light-webfont.woff": "Light weight WOFF format";
    "OpenSans-Light-webfont.svg": "Light weight SVG format";
    "OpenSans-LightItalic-webfont.eot": "Light italic EOT format";
    "OpenSans-LightItalic-webfont.woff": "Light italic WOFF format";
    "OpenSans-LightItalic-webfont.svg": "Light italic SVG format";
    "OpenSans-Semibold-webfont.eot": "Semibold weight EOT format";
    "OpenSans-Semibold-webfont.woff": "Semibold weight WOFF format";
    "OpenSans-Semibold-webfont.svg": "Semibold weight SVG format";
    "OpenSans-Semibold-webfont.ttf": "Semibold weight TTF format";
    "OpenSans-SemiboldItalic-webfont.eot": "Semibold italic EOT format";
    "OpenSans-SemiboldItalic-webfont.woff": "Semibold italic WOFF format";
    "OpenSans-SemiboldItalic-webfont.svg": "Semibold italic SVG format";
    "OpenSans-SemiboldItalic-webfont.ttf": "Semibold italic TTF format";
  };
}

Navigation Generation

Builds hierarchical navigation sidebar from JSDoc member data.

/**
 * Create the navigation sidebar HTML
 * @param {Object} members - The members that will be used to create the sidebar
 * @param {Array} members.classes - Class doclets
 * @param {Array} members.externals - External doclets  
 * @param {Array} members.globals - Global doclets
 * @param {Array} members.mixins - Mixin doclets
 * @param {Array} members.modules - Module doclets
 * @param {Array} members.namespaces - Namespace doclets
 * @param {Array} members.tutorials - Tutorial doclets
 * @param {Array} members.events - Event doclets
 * @param {Array} members.interfaces - Interface doclets
 * @returns {string} The HTML for the navigation sidebar
 */
function buildNav(members);

Page Generation

Generates individual HTML pages for different documentation types.

/**
 * Generate an HTML documentation page
 * @param {string} type - The type of page being generated
 * @param {string} title - The page title
 * @param {Array} docs - Array of doclets to include in the page
 * @param {string} filename - Output filename for the generated page
 * @param {boolean} resolveLinks - Whether to resolve JSDoc link references (default: true)
 */
function generate(type, title, docs, filename, resolveLinks);

/**
 * Generate source code view pages
 * @param {Object} sourceFiles - Object mapping file paths to source file data
 * @param {string} encoding - File encoding to use when reading source files (default: "utf8")
 */
function generateSourceFiles(sourceFiles, encoding);

/**
 * Generate tutorial pages from JSDoc tutorial data (internal function)
 * @param {string} title - Tutorial title
 * @param {Object} tutorial - Tutorial object with content and metadata
 * @param {string} filename - Output filename for the tutorial page
 */
function generateTutorial(title, tutorial, filename);

Doclet Processing

Utilities for processing and enhancing JSDoc doclets with template-specific formatting.

/**
 * Find doclets matching specification (wrapper around helper.find)
 * @param {Object} spec - Query specification object
 * @returns {Array} Array of matching doclets
 */
function find(spec);

/**
 * Determine if doclet needs function signature
 * @param {Object} doclet - JSDoc doclet object
 * @returns {boolean} True if signature is needed
 */
function needsSignature(doclet);

/**
 * Add parameter signature to function doclet
 * @param {Object} f - Function doclet to enhance
 */
function addSignatureParams(f);

/**
 * Add return type signature to function doclet
 * @param {Object} f - Function doclet to enhance  
 */
function addSignatureReturns(f);

/**
 * Add type signature to member doclet
 * @param {Object} f - Member doclet to enhance
 */
function addSignatureTypes(f);

/**
 * Add attributes to doclet for display
 * @param {Object} f - Doclet to enhance with attributes
 */
function addAttribs(f);

/**
 * Get signature attributes for a doclet item
 * @param {Object} item - Doclet item to process
 * @returns {Array} Array of attribute strings
 */
function getSignatureAttributes(item);

/**
 * Update item name with signature attributes
 * @param {Object} item - Item to update
 * @returns {string} Updated item name with attributes
 */
function updateItemName(item);

/**
 * Add parameter attributes to parameters array
 * @param {Array} params - Parameters to process
 * @returns {Array} Processed parameter names
 */
function addParamAttributes(params);

/**
 * Build type strings for display
 * @param {Object} item - Item with type information
 * @returns {Array} Array of type strings
 */
function buildItemTypeStrings(item);

/**
 * Build attributes string for display
 * @param {Array} attribs - Array of attributes
 * @returns {string} Formatted attributes string
 */
function buildAttribsString(attribs);

/**
 * Add non-parameter attributes to items
 * @param {Array} items - Items to process
 * @returns {Array} Array of type strings
 */
function addNonParamAttributes(items);

/**
 * Process tutorial children recursively (internal function)
 * @param {Object} node - Tutorial node with children
 */
function saveChildren(node);

Link and Path Utilities

Helper functions for generating links and managing file paths in documentation.

/**
 * Create tutorial link HTML
 * @param {string} tutorial - Tutorial identifier
 * @returns {string} HTML link to tutorial
 */
function tutoriallink(tutorial);

/**
 * Get ancestor links for doclet inheritance chain
 * @param {Object} doclet - JSDoc doclet object
 * @returns {Array} Array of ancestor link objects
 */
function getAncestorLinks(doclet);

/**
 * Convert hash reference to clickable link
 * @param {Object} doclet - Context doclet for link resolution
 * @param {string} hash - Hash reference to convert
 * @returns {string} HTML link element
 */
function hashToLink(doclet, hash);

/**
 * Shorten file paths for display by removing common prefix
 * @param {Object} files - Object mapping file paths to file data
 * @param {string} commonPrefix - Common prefix to remove from paths
 * @returns {Object} Files object with shortened paths added
 */
function shortenPaths(files, commonPrefix);

/**
 * Extract file path from doclet metadata
 * @param {Object} doclet - JSDoc doclet with meta information
 * @returns {string|null} File path or null if no path available
 */
function getPathFromDoclet(doclet);

/**
 * Attach module symbols to module doclets (mutates original arrays)
 * @param {Array} doclets - Array of classes and functions to check
 * @param {Array} modules - Array of module doclets to search
 * @returns {Array} Modified modules array with attached symbols
 */
function attachModuleSymbols(doclets, modules);

/**
 * Build member navigation for a specific item type
 * @param {Array} items - Items to build navigation for
 * @param {string} itemHeading - Heading text for the item section
 * @param {Object} itemsSeen - Object tracking which items have been processed
 * @param {Function} linktoFn - Function to generate links for items
 * @returns {Array} Navigation HTML elements
 */
function buildMemberNav(items, itemHeading, itemsSeen, linktoFn);

/**
 * Generate navigation link wrapper
 * @param {string} linkClass - CSS class for the navigation link
 * @param {string} linkContent - HTML content for the link
 * @returns {string} HTML list item with navigation link
 */
function buildNavLink(linkClass, linkContent);

/**
 * Generate navigation heading wrapper
 * @param {string} content - Navigation header content
 * @returns {string} HTML list item with navigation heading
 */
function buildNavHeading(content);

/**
 * Generate navigation item wrapper
 * @param {string} itemContent - Navigation item content
 * @returns {string} HTML list item with navigation item
 */
function buildNavItem(itemContent);

/**
 * Generate navigation type indicator
 * @param {string} type - Type of the navigation item (function, class, etc.)
 * @param {string} typeLink - Link HTML for the type
 * @returns {string} HTML with type indicator and link
 */
function buildNavType(type, typeLink);

/**
 * Link to tutorial helper function
 * @param {string} longName - Tutorial long name
 * @param {string} name - Tutorial display name
 * @returns {string} Tutorial link HTML
 */
function linktoTutorial(longName, name);

/**
 * Link to external helper function
 * @param {string} longName - External long name
 * @param {string} name - External display name
 * @returns {string} External link HTML
 */
function linktoExternal(longName, name);

Types

/** JSDoc doclet object containing parsed documentation data */
interface Doclet {
  /** Doclet kind (function, class, member, etc.) */
  kind: string;
  /** Full qualified name */
  longname: string;
  /** Short name */
  name: string;
  /** Description text */
  description?: string;
  /** Parameter information for functions */
  params?: Array<{
    name: string;
    type?: { names: string[] };
    description?: string;
    optional?: boolean;
    nullable?: boolean;
    variable?: boolean;
  }>;
  /** Return value information */
  returns?: Array<{
    type?: { names: string[] };
    description?: string;
  }>;
  /** Code examples */
  examples?: string[];
  /** See also references */
  see?: string[];
  /** File metadata */
  meta?: {
    path: string;
    filename: string;
    shortpath?: string;
  };
  /** Inheritance information */
  ancestors?: Array<{ name: string; url: string }>;
  /** Generated signature HTML */
  signature?: string;
  /** Generated attributes HTML */
  attribs?: string;
}

/** Template view object for rendering templates */
interface TemplateView {
  /** Find function for querying doclets */
  find: (spec: Object) => Array<Doclet>;
  /** Create link to doclet */
  linkto: (longname: string, text?: string) => string;
  /** Resolve author links */
  resolveAuthorLinks: (text: string) => string;
  /** Create tutorial link */
  tutoriallink: (tutorial: string) => string;
  /** Make text HTML-safe */
  htmlsafe: (text: string) => string;
  /** Whether to output source files */
  outputSourceFiles: boolean;
  /** Generated navigation HTML */
  nav: string;
  /** Layout template file */
  layout: string;
  /** Render template with data */
  render: (templateName: string, data: Object) => string;
}

Error Handling

Minami handles several error conditions during documentation generation:

  • Missing source files: Logs errors when source files cannot be read for source view generation
  • Template rendering errors: JSDoc's template engine handles template syntax errors
  • Invalid doclet data: Gracefully handles missing or malformed doclet properties
  • File system errors: Handles directory creation and file writing errors during output generation
  • Navigation typos: Contains a typo bug in line 388 where linkfoFn should be linktoFn

Usage Examples

Basic JSDoc Integration

# Install minami as development dependency
npm install --save-dev minami

# Generate documentation with minami template
npx jsdoc src/ -t node_modules/minami -d docs/

Advanced Configuration

{
  "tags": {
    "allowUnknownTags": true,
    "dictionaries": ["jsdoc"]
  },
  "source": {
    "include": ["./src"],
    "includePattern": "\\.(js|jsx)$",
    "exclude": ["node_modules/"]
  },
  "plugins": ["plugins/markdown"],
  "templates": {
    "cleverLinks": false,
    "monospaceLinks": true,
    "useLongnameInNav": 3,
    "showInheritedInNav": true
  },
  "opts": {
    "destination": "./documentation/",
    "encoding": "utf8",
    "private": false,
    "recurse": true,
    "template": "./node_modules/minami"
  }
}

Package.json Script Integration

{
  "scripts": {
    "docs": "jsdoc --configure .jsdoc.json --verbose",
    "docs:watch": "nodemon --watch src --ext js --exec \"npm run docs\""
  }
}