.github/
├── README.md # This file
├── assets/ # Website assets
│ ├── css/ # CSS stylesheets
│ │ ├── academicons-1.7.0/ # Academic icons
│ │ ├── command-palette.css # Command palette styling
│ │ ├── custom_styles.css # Custom styling
│ │ ├── fontello/ # Font icons
│ │ ├── fonts/ # Web fonts
│ │ ├── styles.css # Main stylesheet
│ │ └── vendor.css # Third-party styles
│ ├── js/ # JavaScript files
│ │ ├── command-data.js # Command palette data
│ │ ├── command-palette.js # Command palette functionality
│ │ ├── main.js # Main JavaScript functionality
│ │ ├── search_db.json # Search database
│ │ ├── shortcut-key.js # Keyboard shortcuts
│ │ └── theme-toggle.js # Theme switching
│ ├── custom_template.html # HTML template for generated pages
│ ├── favicon/ # Favicon files
│ └── logos/ # Logo images
├── scripts/ # Build and deployment scripts
│ ├── build.sh # Build script
│ ├── deploy.sh # Deployment script
│ └── generate_docs.py # Documentation generator
└── workflows/ # GitHub Actions workflows
This directory contains all the necessary files and scripts for generating and deploying the documentation of codes develped by CoMPhy Lab. The website is generated from source code files in the repository and is deployed at comphy-lab.org/repositoryName.
The website generation process is handled by the generate_docs.py
script, which converts source code files into HTML documentation. The process involves several steps:
- Source File Discovery: The script scans the repository for source files in specified directories (
src-local
,simulationCases
,postProcess
). - File Processing: Each file is processed based on its type (C/C++, Python, Shell, Markdown).
- HTML Generation: The processed content is converted to HTML using Pandoc with a custom template.
- Post-Processing: The generated HTML is enhanced with additional features like code highlighting and navigation.
- Index Generation: An index page is created from the README.md file.
- SEO Optimization: Robots.txt and sitemap.xml files are generated for search engines.
This Python script is the core of the documentation generation process. It performs the following functions:
- Configuration Validation: Ensures all required paths and files exist.
- Source File Discovery: Finds all source files in specified directories.
- File Processing: Processes different file types (C/C++, Python, Shell, Markdown) with specialized functions.
- HTML Generation: Uses Pandoc to convert processed content to HTML.
- Post-Processing: Enhances HTML with additional features.
- Index Generation: Creates an index page from README.md.
- SEO Optimization: Generates robots.txt and sitemap.xml.
This shell script runs the documentation generation process:
- Sets up the environment and paths.
- Runs the
generate_docs.py
script. - Verifies that the documentation was generated successfully.
This shell script provides a local preview of the generated documentation:
- Verifies that the documentation exists.
- Starts a local web server on port 8000.
- Provides instructions for accessing the site.
This HTML template is used by Pandoc to generate the HTML pages:
- Defines the basic HTML structure.
- Includes meta tags for SEO.
- Links to CSS and JavaScript files.
- Provides placeholders for dynamic content.
- styles.css: Main stylesheet with comprehensive styling for the website.
- custom_styles.css: Custom styling specific to the CoMPhy Lab website.
- command-palette.css: Styling for the command palette feature.
- vendor.css: Third-party styles.
- main.js: Main JavaScript functionality for the website.
- command-palette.js: Implements the command palette feature.
- command-data.js: Data for the command palette.
- theme-toggle.js: Handles theme switching (light/dark mode).
- shortcut-key.js: Implements keyboard shortcuts.
- search_db.json: Search database for the website.
The website is deployed at comphy-lab.org using GitHub Pages. The deployment process involves:
- Generating the documentation using
build.sh
. - Pushing the generated documentation to the
gh-pages
branch. - GitHub Pages serves the content from the
gh-pages
branch.
To customize the website:
- Styling: Modify the CSS files in
.github/assets/css/
. - Functionality: Modify the JavaScript files in
.github/assets/js/
. - Template: Modify the HTML template in
.github/assets/custom_template.html
. - Generation Process: Modify the Python script in
.github/scripts/generate_docs.py
.
If the documentation generation fails:
- Check the error messages from the
build.sh
script. - Verify that all required paths and files exist.
- Ensure that Pandoc is installed and accessible.
- Check that the Python script has the necessary permissions.
- The website uses a custom template based on the Basilisk documentation.
- The documentation generation process is designed to handle C/C++, Python, Shell, and Markdown files.
- The website includes features like code highlighting, navigation, and search.
- SEO optimization is included to improve search engine visibility.