Skip to content
FulisikePublic

About

A tiny tool aims to display contents from documents/multimodal through browsers everywhere. Now from .md projects only.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Kepper

A tiny tool aims to display contents from documents/multimodal through browsers everywhere. Now from .md projects only.

Environment

python 3.12.0

dependencies are listed in requirements.txt

Usage

# basic usage
python main.py /path/to/source/directory

# target the output directory
python main.py /path/to/source/directory -o my_output

# no launch server
python main.py /path/to/source/directory --no-server

# target the server port
python main.py /path/to/source/directory -p 9000

# full args example
python main.py /path/to/source/directory -o output -j my_structure.json -c styles.css --host 0.0.0.0 -p 8080
from main import MarkdownToHtmlProcessor

# create processor
processor = MarkdownToHtmlProcessor()

# run the workflow
processor.process_complete_workflow(
    source_dir="/path/to/source",
    output_dir="output",
    start_server=True,
    host="127.0.0.1",
    port=8000
)

You can also independently use single modules imported from utils/*.py in your codes.

Workflow

  1. File Extraction: Recursively traverse the source directory and extract the content of all Markdown files.
  2. JSON Saving: Save the file structure in JSON format.
  3. HTML Generation: Generate an HTML book with a sidebar based on the JSON file.
  4. Resource Copying: Copy the res folder from the source directory to the corresponding location in the output directory.
  5. Server Startup: Start a Web server to host the generated HTML book.

Features

  • Modular Design: Each function is an independent module for easy reuse and maintenance.
  • Resource File Support: Automatically copy the res folder to the correct location.
  • Command-Line Interface (CLI): Supports various parameter configurations.
  • Programming Interface: Provides a Python API for calling by other programs.
  • Logging: Detailed log records for easy debugging.
  • Error Handling: Comprehensive error handling and user prompts.

Notes

  1. Ensure the source directory contains Markdown files.
  2. The CSS file (styles.css) should be in the same directory as the script.
  3. The output directory will be cleared and rebuilt.
  4. Resource file copying will overwrite any existing folder with the same name.
  5. The server will run on 127.0.0.1:8000 by default.

Contributions & Feedback

Contributions are welcome! Please feel free to open issues or pull requests if you have any suggestions or find any problems.

Welcome to contact the author via email: hjklmoving@gmail.com.

About

A tiny tool aims to display contents from documents/multimodal through browsers everywhere. Now from .md projects only.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages