Code Monkey home page Code Monkey logo

mh-ssg's Introduction

mh-ssg

A simple static site generator that converts text files or markdown files into HTML files

Features

  • Allows input of a single text file or a markdown file
  • Allows input of a directory containing text file(s)
  • Supports custom stylesheet
  • Supports user-specified output folder
  • Supports JSON config files
  • Finds and sets title to HTML file (if available and only works for .txt file)
  • Finds and converts Markdown syntax (Heading 1-6, italics, bold, link, inline code, horizontal rule) into correct HTML tags

Installation

  1. Clone the project
  2. Install NodeJs
  3. Redirect to project directory
  4. Install the tool with npm i -g .

Help

Usage: mh-ssg -i <filename> -o <path> -s <stylesheet>

Options:
  -h, --help        Show help                                          [boolean]
  -i, --input       Specify input file or input folder (required)        [array]
  -o, --output      Specify output path                                  [array]
  -s, --stylesheet  Specify stylesheet for html file                    [string]
  -v, --version     Show version number                                [boolean]

Example

Using mh-ssg -i file.txt -o folder -s https://cdn.jsdelivr.net/npm/water.css@2/out/water.css will convert

./file.txt
Silver Blaze


I am afraid, Watson, that I shall have to go,” said Holmes, as we
sat down together to our breakfast one morning.

“Go! Where to?”

“To Dartmoor; to King’s Pyland.”

into

./folder/file.html
<!doctype html>
<html lang="en" dir="ltr">
<head>
<title>Silver Blaze</title>
<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">


</head>
<body>
<h1>Silver Blaze</h1>

<p>I am afraid, Watson, that I shall have to go,” said Holmes, as we sat down together to our breakfast one morning.</p>

<p>“Go! Where to?”</p>

<p>“To Dartmoor; to King’s Pyland.”</p>

</body>
</html>

Using mh-ssg -c ~/<path>/sample.json will generate the same result

sample.json
{
  "input": "./Sherlock-Holmes-Selected-Stories",
  "output": "./build",
  "stylesheet": "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css"
}

License

This project is licensed under the MIT License

mh-ssg's People

Contributors

minhhang107 avatar mqnguyen5 avatar tuanthanh2067 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.