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

inputmd

v0.1.2

Published

A simple and fast view engine that supports basic markdown syntax.

Downloads

1

Readme

Input MD

npm Libraries.io dependency status for latest release GitHub top language NPM

npm npm

paypal

A simple and fast view engine that supports basic markdown syntax.

The goal of this module is to provide a minimal view engine, while including some of the basic functionalities you may need. Basic markdown is compiled and cached from the actual file, to keep things fast. Basic inputs are handled with a handlebars syntax without the complex functions of hbs. You can import other files in a simple way and can also setup a default template.

Not every part of markdown is included, and some changes were made for better html compatibility. Leaving a small amount of markdown so you can have more control over the style of your website.

Inside an html FORM tag, you can use a syntax similar to WordPress Contact Form 7 but there are some differences between the 2.

Installation

npm install @aspiesoft/inputmd

Setup

const imdl = require('@aspiesoft/inputmd');

// express
const express = require('express');
const app = express();

const {join} = require('path');

app.engine('imdl', imdl(__dirname+'/views', {
  template: 'layout',
  cache: '2h',
  opts: {default: 'some default options for res.render'}
}));
app.set('views', join(__dirname, 'views'));
app.set('view engine', 'imdl');

Usage


// express
app.get('/', (req, res) => {
  res.render('index', {randomInput: 'My Var Input'});
});

// other
let htmlOutput = imdl('index', {
  randomInput: 'My Var Input',
  functionInput: function(options){
    // do stuff...
    options === this Object
    return 'something';
  }
});

# Heading 1

***Bold Italic***

> Block Quote

<!-- To grab any js input -->
{{randomInput}}

<!-- If you pass a function, it will run and display its return value -->
{{functionInput}}

<!-- Import any other imdl file (or the extension you chose) using a # -->
{{{#common/header}}}


<!-- HTML vs escaped HTML -->

// using {{2}} will escape HTML entities
{{escapedHTML}}

// using {{{3}}} will keep HTML entities
{{{validHTML}}}


<!-- This is a comment -->

/*
  This is also a comment
*/

// This is an inline comment

For improved compatibility with HTML, the extra comments will not work if there are any non whitespace characters in front of them on the same line

and /*
  this is not a comment
*/

and // this is not a comment


List
 - item1
 - item2
   - subitem
 - item3

Ordered List
 1. item
 2. item
 3. item

Ordered List (reverse)
 3. item
 2. item
 1. item


<!-- Links -->

// basic markdown
[AspieSoft](https://www.aspiesoft.com)

// also will auto convert
https://www.aspiesoft.com

// will leave quoted links alone for HTML compatibility
<a href="https://www.aspiesoft.com">AspieSoft</a>


<!-- Embeds (a bit different than vanilla markdown) -->
![image](/my/image.png)

![video](/my/video.mp4)

![embed](https://www.youtube.com/embed/iframeVideo)

// you can also setup backup images
![img](
  /my/image.webp
  /my/image.png
  /my/image.jpg
)

// and you can pass inline attributes

![mp4](/my/video.mp4){autoplay class="video-style" style="..."}


Table

| key | value |
| --- | ----- |
| a   | 1     |
| b   | 2     |
| c   | 3     |
| d | 4 |         <!-- Still Works -->
| e   | 5     |
|   More      |   <!-- row will be given the class "small" -->
| f   | 6     |
| g   | 7     |
| h   | 8     |
|             |   <!-- row will be given the class "blank" -->
| z   | 26 | -1 | <!-- row will be given the class "big" -->
| i   | 9     |
| j   | 10    |

There are also some shortcuts for common html entities

| shortcut | entity | | -------- | ------ | | &< | < | | &> | > | | &; | & | | && | & | | &* | * | | &/ | / | | &\ | \ | | &" | " | | &' | ' | | &` | ` | | &? | ? | | &= | = | | | | &+- | ± | | &?= | ≈ | | &!= | ≠ | | &<= | ≤ | | &>= | ≥ | | &^/ | √ | | | | &# | π | | &#pi | π | | &#s | § | | &#p | ¶ | | &#c | © | | &#r | ® | | &#o | ° | | &#d | ° | | &#i | ∞ | | | | &$ | ¢ | | &$c | ¢ | | &$p | £ | | &$e | € | | &$y | ¥ | | &$r | ₹ | | &$u | 元 | | &$w | ₩ |

Forms

  <form>
    [label input_name "Label For Input"]
    [text* input_name "placeholder text" "default value"]{attr="an attribute added to the input" attr2="another attribute"}

    [number number_input "placeholder" "0"]

    [select name {"group" value1:"name 1" value2:"name 2 (default/selected)"* value3:"name 3"} value4:"Item 4" value4:"Item 5"]

    [select color {"basic" r:"red" g:"green"* b:"blue"} y:"yellow" p:"purple"]

    [check myCheckbox "Check This Box :)"]
    [accept* anotherCheckbox "Accept terms"] <!-- This has the class "accept" added to it -->

    [radio gender "male" "female"]

    [textarea comments "placeholder text" "default value"]

    [list ideas 'a textarea with the class "list" added to it' "Single Quotes Work :) and \"escaped\" quotes"]

    [email email "email"]

    [tel tel "tel"]

    [url url "url"]

    [hidden name "value"]

    [button "Button Value"]

    [submit "Submit"]
  </form>