This project uses VitePress to generate a static website from Markdown files located in the docs directory.
To run the local development server with hot-reloading:
- Make sure you have Node.js installed.
- Install the project dependencies:
npm install
- Start the development server:
This will typically make the site available at
npm run docs:dev
http://localhost:5173.
The site supports an embed mode that hides navigation elements, making it suitable for embedding pages in iframes.
To use embed mode, append ?embed=true to any page URL:
https://example.com/lessons/lesson-1/topics/design_thinking.html?embed=true
This will:
- Hide the navigation bar
- Hide the sidebar
- Hide the footer
- Hide next/previous page navigation
- Hide the license footer
- Hide edit links and additional VitePress navigation elements
- Remove all padding and margins from the content area
This feature is useful when you want to embed specific content from the site into another webpage or learning management system without showing the navigation elements.
Example iframe implementation:
<iframe
src="https://example.com/lessons/lesson-1/topics/design_thinking.html?embed=true"
width="100%"
height="600px"
frameborder="0">
</iframe>To build the static website for deployment:
-
Run the build command:
npm run docs:build
This command performs two steps:
vitepress build docs: Compiles the Markdown files and VitePress application into static HTML, CSS, and JavaScript files in the.vitepress/distdirectory.node scripts/generate-content-api.mjs: After the build, this script runs automatically to generate acontent-api.jsonfile at the following url:/api/content-api.json.
-
The contents of the
.vitepress/distdirectory are ready to be deployed to any static hosting provider (like Netlify, Vercel, GitHub Pages, etc.).
To preview the built site locally before deploying:
npm run docs:previewThis will serve the contents of .vitepress/dist.
This project includes a script to find and check the status of external links within the Markdown files in the docs directory.
- Script Location:
scripts/check_external_links.js - Functionality:
- Scans all
.mdfiles underdocs/. - Extracts all external URLs (http/https).
- Sends a HEAD request to each unique URL to check if it's reachable (OK, Not Found, Redirect, Timeout, Error).
- Generates a CSV report named
external_links_report.csvin the workspace root containing the URL, the file path where it was found, the line number, and the status.
- Scans all
- How to Run:
Navigate to the workspace root in your terminal and run:
Note: This script requires
node scripts/check_external_links.js
node-fetch(v2) which should be installed vianpm install.
- Script Location:
scripts/generate-content-api.mjs - JSON API URL:
https://dmd-program.github.io/dmd-100-book/api/content-api.json - Functionality: This script is automatically executed as part of the
npm run docs:buildprocess. It scans the built Markdown content or source files to create a structured JSON representation (content-api.json) of the site's content hierarchical structure, including:- Site title and description
- Complete course outline with lessons, topics, readings, projects, and activities
- Page titles and relative links for all content
- Nested structure following the VitePress sidebar organization
- Use Cases: This API can be used to programmatically access the course structure for integration with other systems, building custom navigation interfaces, or generating alternative views of the content.
This project includes a script to generate a Common Cartridge (IMSCC v1.1) package based on the VitePress site structure defined in docs/.vitepress/config.mjs.
This allows importing the course structure (as defined by the sidebar) into Learning Management Systems (LMS) like Canvas, Moodle, etc. Each page link in the sidebar will be represented as a web link item in the cartridge, pointing to the corresponding page on the live site with an ?embed=true parameter appended (suitable for embedding in an iframe).
To generate the .imscc file, run the following command from the root of the vitepress-dmd-100 directory:
node scripts/generate-common-cartridge.mjsThis will create a file named common-cartridge-export.imscc in the project root directory. You can then upload this file to your LMS.