npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

text-ssg

v1.0.3

Published

This is a Static Site Generator CLI that convert .txt and .md files into .html files

Downloads

1

Readme

Static Site Generator in CLI that convert .txt and .md files into .html files

Install

  1. Install package

     npm install -g text-ssg@latest

Features

  • Supports stylesheets. By passing a url of stylesheet to -s or --stylesheet, if not specified it will use a default stylesheet (See usage).
  • Supports titles. If the first line is followed by two blank lines, it will populate the <title>...</title> and <h1>...</h1>.
  • Supports specific output. By passing an existing folder to -o or --output, if not specified it will generate to dist folder (See usage).
  • Supports deep tree of files and folders. If the user specifies a folder for --input or -i
  • Generate a menu page index.html which has relative links to each of the generated HTML files.
  • New paragraph is separated by a line.
  • Supports language code for HTML tag lang attribute. By passing a language code to -l or --lang, if not specified it will use a default lang (See usage).
  • Markdown support: headings, horizontal line, inline italic or bold texts, links with or without title
  • Configuration support: User can specify multiple configuration in one json file and pass the file with -c or --config.

Usage

ssg --input <path>

ssg --input <path> --output <path>

ssg --input <path> --output <path> --stylesheet <URL>

ssg --input <path> --output <path> --stylesheet <URL> --lang <languageCode>

ssg -i <path> -o <path> -s <URL> -l <languageCode>

ssg -c <path> -i <path>

Commands Supported

  _____                 _                 ____    ____     ____
 |_   _|   ___  __  __ | |_              / ___|  / ___|   / ___|
   | |    / _ \ \ \/ / | __|    _____    \___ \  \___ \  | |  _
   | |   |  __/  >  <  | |_    |_____|    ___) |  ___) | | |_| |
   |_|    \___| /_/\_\  \__|             |____/  |____/   \____|

Options:
    -v, --version     Show version number                [boolean]
    -h, --help        Show help                             [boolean]
    -i, --input       Folder/File input location            [string] [required]
    -s, --stylesheet  URL to a CSS stylesheet              [string]
    -o, --output      Folder output location          [string] [default: "./dist"]
    -l, --lang        HTML lang tag                    [string] [default: "en-CA"]
    -c, --config      Folder/File configuration JSON file location        [string]

Example

Input file: test.txt

This is the title


Hello world,
2021

This is a static site

I love programing

Command ran

ssg -i test.txt -s 'https://cdn.jsdelivr.net/npm/water.css@2/out/water.css' -l en-US

Output file: dist/index.html

<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="UTF-8" />
    <title>Home</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" />
  </head>

  <body>
    <h1>Home menu</h1>
    <h2>Summary</h2>
    <ul>
      <li><a href="test.html">test</a></li>
    </ul>
  </body>
</html>

dist/test.html

<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="UTF-8" />
    <title>This is the title</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" />
  </head>

  <body>
    <h1>This is the title</h1>
    <p>Hello world,2021</p>
    <p>This is a static site</p>
    <p>I love programing</p>
  </body>
</html>

Example - Using configuration JSON file

Input file: test.txt

This is the title


Hello world,
2021

This is a static site

I love programing

Config file: config.json

{
  "lang": "en-CA",
  "output": "./newDist"
}

Command ran

ssg -c samples/config.json -i test.txt

Output file: newDist/index.html

<!DOCTYPE html>
<html lang="en-CA">
  <head>
    <meta charset="UTF-8" />
    <title>Home</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" />
  </head>

  <body>
    <h1>Home menu</h1>
    <h2>Summary</h2>
    <ul>
      <li><a href="test.html">test</a></li>
    </ul>
  </body>
</html>

newDist/test.html

<!DOCTYPE html>
<html lang="en-CA">
  <head>
    <meta charset="UTF-8" />
    <title>This is the title</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" />
  </head>

  <body>
    <h1>This is the title</h1>
    <p>Hello world,2021</p>
    <p>This is a static site</p>
    <p>I love programing</p>
  </body>
</html>

Author

👨‍💻 Kevan Yang

Show your support

Give a ⭐️ to this project.