Giter Site home page Giter Site logo

kristofhracza / docgen Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 371 KB

Documentation Platform

Python 25.90% JavaScript 28.62% CSS 31.77% HTML 13.71%
content-platform documentation documentation-generator documentation-tool md-file-converter md-to-html webhosting

docgen's Introduction

DocGen

The poor man's documentation platform

What is this?

DocGen converts MD files to HTML whilst placing them into an environment that is suitable for web hosting.

Demo image

Setup

First, you're going to have to edit the PUBLIC_FOLDER variable in .env (unless you're happy with the default name). This will be your main folder for the website

Though keep in mind, that if you change PUBLIC_FOLDER, you're going to have to change the name of the site folder.

  1. Download dependencies pip install -r requirements.txt
  2. If you need any more assets linked, make sure to edit
    # Edit this if you need more
    ASSESTS = '''
    <link rel="stylesheet" href="{0}assets/style.css">
    <link rel="stylesheet" href="{0}assets/prism.css">
    <script type="text/javascript" src="{0}assets/prism.js"></script>
    '''
    this part of the python code.
  3. Move your .md files to this project, they don't have to be in a folder, but the structure is much nicer if they are.
  4. Setup SUMMARY.json according to your .md file structure (more on that later)
  5. Run docgen.py, and if everything is fine, your files should be converted and added to PUBLIC_FOLDER.

SUMMARY.json

In this file you will write the structure of your files.

Example

{
    "README":"md/README.md",
    "First":{
        "MAIN":"some/path/to/md/file",
        "Sub-heading":{
            "MAIN":"some/path/to/md/file",
        },
    },
    "Second":{
        "Feature one":"some/path/to/md/file",
        "Feature two":"some/path/to/md/file"
    }
}

The example above would produce following structure:

  • README
  • First
    • Sub-heading
  • Second
    • Feature one
    • Feature two

The entries labeled as MAIN should be files that describe the sub-header.

PUBLIC_FOLDER structure

Any file that is in the PUBLIC_FOLDER directory has a purpose.

They can be edited or even deleted, but be aware that their modification or deletion could result in an error / bug.

PrismJS

For code highlight I've used PrismJS.

The prism.js file in the assets folder, is from an online generator.
However, the prism.css file is taken from Github, the theme is One Dark.

How does all the content get rendered?

This is a very janky soultion, but in the index.html file there's an iframe element.
When a list element in the sidebar is clicked, it has a corresponding link and will add that to the iframe.

if (isMain === false) newText.onclick = () => {
    document.getElementById("page-render").src = url;
    document.title = "DocGen " + text;
    localStorage.setItem("lastPage",url)
}

The last page will be saved to local storage, and will be rendered upon re-freshing or re-opening the page.

LINKS.json

You don't have to worry about that, it's just output from docgen.py that will be used in loader.js

docgen's People

Contributors

kristofhracza 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.