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

til-tool

v1.0.1

Published

A command-line tool for authoring "Today I Learned" posts in Markdown, which can be converted to HTML for publishing on the web

Downloads

4

Readme

Til-Tool

This is a simple command-line tool to convert .txt files into genereated .html files.

Download

$ npm i til-tool

Features

  • Pass in a .txt file and it'll generate an html file which is stored in ./til directory.
  • Pass in a directory and it'll look for and find all .txt files within the directory and genereate multiple html files in ./til directory.

Argument

| Argument | Role | | ---------------- | ---------------------- | | fileName/dirName | converts files to html |

Example: Converts a .text file .html file

./example1.txt
This is the first paragraph.

This is the second paragraph.
$ ts-node src/index.ts example1.txt
./til/example1.html

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>example1</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    </head>
    <body>
        <h1>example1</h1>
        <p>This is the first paragraph.</p>
        <p>This is the second paragraph.</p>
    </body>
</html>

Example: Convert .txt files in a directory to .html files stored in ./til direcotry

./examples/text1.txt
This is the text1.txt in examples directory.

This is the text1.txt in examples directory.

./examples/text2.txt
This is the text2.txt in examples directory.

This is the text2.txt in examples directory.
$ ts-node src/index.ts examples
./til/text1.html

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>text1</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    </head>
    <body>
        <h1>text1</h1>
        <p>This is the text1.txt in examples directory.</p>
        <p>This is the text1.txt in examples directory.</p>
    </body>
</html>
./til/text2.html

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>text2</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    </head>
    <body>
        <h1>text2</h1>
        <p>This is the text2.txt in examples directory.</p>
        <p>This is the text2.txt in examples directory.</p>
    </body>
</html>

Options

| Option | Role | | ---------------- | ----------------------------- | | -v, --version | outputs the current version | | -o, --output | creates a specified directory | | -s, --stylesheet | sets a stylesheet to HTML | | -h, --help | display help for command | | -l, --lang | indicates the language to use |

Usages

-v, --version:

$ ts-node src/index.ts -v
$ ts-node src/index.ts --version

-h, --help:

$ ts-node src/index.ts -h
$ ts-node src/index.ts --help

-o, --output:

Allow the user to specify a different output directory using --output or -o. If not specified, til will be used, but if the user specifies a different output path, use that. The program should create the directory if it does not exist.

Example: Converts a .text file to .html file stored in the specified directory instead './til'

./example1.txt
This is the first paragraph.

This is the second paragraph.
$ ts-node src/index.ts example1.txt -o build
$ ts-node src/index.ts example1.txt --output build
./build/example1.html

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>example1</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    </head>
    <body>
        <h1>example1</h1>
        <p>This is the first paragraph.</p>
        <p>This is the second paragraph.</p>
    </body>
</html>

Example: Convert .txt files in a directory to .html files stored in the specified directory instead './til'

./examples/text1.txt
This is the text1.txt in examples directory.

This is the text1.txt in examples directory.

./examples/text2.txt
This is the text2.txt in examples directory.

This is the text2.txt in examples directory.
$ ts-node src/index.ts examples -o build
$ ts-node src/index.ts examples --output build
./build/text1.html

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>text1</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    </head>
    <body>
        <h1>text1</h1>
        <p>This is the text1.txt in examples directory.</p>
        <p>This is the text1.txt in examples directory.</p>
    </body>
</html>
./build/text2.html

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>text2</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    </head>
    <body>
        <h1>text2</h1>
        <p>This is the text2.txt in examples directory.</p>
        <p>This is the text2.txt in examples directory.</p>
    </body>
</html>

-s, --stylesheet:

Allow the user to optionally specify a --stylesheet or -s URL to a CSS stylesheet to be used in the of your generated HTML files.

Example: Converts a .text file to .html file with a stylesheet

./example1.txt
This is the first paragraph.

This is the second paragraph.
$ ts-node src/index.ts example1.txt -s https://cdn.jsdelivr.net/npm/water.css@2/out/water.css
$ ts-node src/index.ts example1.txt --stylesheet https://cdn.jsdelivr.net/npm/water.css@2/out/water.css
./til/example1.html

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>example1</title>
        <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>example1</h1>
        <p>This is the first paragraph.</p>
        <p>This is the second paragraph.</p>
    </body>
</html>

Example: Convert .txt files in a directory to .html files with a stylesheet

./examples/text1.txt
This is the text1.txt in examples directory.

This is the text1.txt in examples directory.

./examples/text2.txt
This is the text2.txt in examples directory.

This is the text2.txt in examples directory.
$ ts-node src/index.ts examples -s https://cdn.jsdelivr.net/npm/water.css@2/out/water.css
$ ts-node src/index.ts examples --stylesheet https://cdn.jsdelivr.net/npm/water.css@2/out/water.css
./til/text1.html

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>text1</title>
        <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>text1</h1>
        <p>This is the text1.txt in examples directory.</p>
        <p>This is the text1.txt in examples directory.</p>
    </body>
</html>
./til/text2.html

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>text2</title>
        <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>text2</h1>
        <p>This is the text2.txt in examples directory.</p>
        <p>This is the text2.txt in examples directory.</p>
    </body>
</html>

-l, --lang:

Allow the user to add an optional -i or --lang to indicate the language to use when generating the lang attribute on the root element.

Example: Converts a .text file to .html file with a lang attribute

./example1.txt
This is the first paragraph.

This is the second paragraph.
$ ts-node src/index.ts example1.txt -l br
$ ts-node src/index.ts example1.txt --lang br
./til/example1.html

<!doctype html>
<html lang="br">
    <head>
        <meta charset="utf-8" />
        <title>example1</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    </head>
    <body>
        <p>This is the first paragraph.</p>
        <p>This is the second paragraph.</p>
    </body>
</html>

Example: Convert .txt files in a directory to .html files with a lang attribute

./examples/text1.txt
This is the text1.txt in examples directory.

This is the text1.txt in examples directory.

./examples/text2.txt
This is the text2.txt in examples directory.

This is the text2.txt in examples directory.
$ ts-node src/index.ts examples -l br
$ ts-node src/index.ts examples --lang br
./til/text1.html

<!doctype html>
<html lang="br">
    <head>
        <meta charset="utf-8" />
        <title>text1</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    </head>
    <body>
        <h1>text1</h1>
        <p>This is the text1.txt in examples directory.</p>
        <p>This is the text1.txt in examples directory.</p>
    </body>
</html>
./til/text2.html

<!doctype html>
<html lang="br">
    <head>
        <meta charset="utf-8" />
        <title>text2</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    </head>
    <body>
        <h1>text2</h1>
        <p>This is the text2.txt in examples directory.</p>
        <p>This is the text2.txt in examples directory.</p>
    </body>
</html>

License

MIT