Coder Social home page Coder Social logo

codes2html's Introduction

codes2html

A tool to collect codes into a HTML document with syntax highlighted, written in python (tested with python 3.7 on Mac computer).

The original intention of this tool is for the source code part of "软件著作权", but you may find other usages of collecting codes to a single file.

The script uses pygments to highlight codes.

The script walks through the source paths, and collect all source codes that pygments supports.

If any bug or problem please report an issue.

pygments

Install:

pip install Pygments

In the script, "guess" feature is used to determine the source code syntax, both file name and file content are considered.

Usage

usage: codes2html.py [-h] [-e EXTENSIONS] [-l LINES] [-o OUTPUT]
                     [-i IGNORE_FILE] [-f FILE_FOOTER]
                     source [source ...]

A tool to collect codes and highlight syntax in a single html document.

positional arguments:
  source                source code directory or file

optional arguments:
  -h, --help            show this help message and exit
  -e EXTENSIONS, --extensions EXTENSIONS
                        file extensions to be considered as source files.
                        separated with comma or a single "*" indicates all.
                        e.g. "c,cpp,h,m,mm". default is "*"
  -l LINES, --lines LINES
                        limit the lines of source codes. but the content of a
                        file is always complete, so the final lines may exceed
                        this value. 0 for unlimited. default is 3500
  -o OUTPUT, --output OUTPUT
                        output file path. default is output.html
  -i IGNORE_FILE, --ignore IGNORE_FILE
                        path of the ignore file, similar to .gitignore.
                        default is ignore.txt
  -f FILE_FOOTER, --footer FILE_FOOTER
                        file footer string, you can use </br> to insert lines.
                        default is </br>

codes2html's People

Contributors

ajeyone avatar

Stargazers

 avatar Chandler Sun avatar xue avatar Jay Lee avatar Henry Zhou avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.