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

econtent

v1.2.2

Published

Extended Content Reader

Downloads

3

Readme

Extended Content Reader (JavaScript)

Copyright (c) 2016-2018 David Betz

license Build Status npm version coverage Say Thanks!

Installation

npm install econtent

Home:

Related project:

Purpose

Files have content and metadata. Markdown has already helps us go from boring text files to rich text (without RTF or proprietary voodoo), but it's not enough. My content needs sections and it needs metadata. They already have a create date and a modified date, but I often need to overwrite these. That's where this component comes in. It's been helping me for a few years now (well, this is the Node.JS refactor/port of the Python edition, which itself is a port of my original/production/more complex .NET version).

It's easier to following if you just look at the example...

The following example is ridiculous, but it's an example of the type of stuff you might store in a file:

item01.txt

hollow unbraced needs mineral high fingerd strings red tragical having definement invisible@@footnote|78@@. flames grow pranks obey hearsed variable grandsire bodykins possessd worser oerthrown oerweigh healthful kingly wise faculty loggats best.

unfortified chopine hill witchcraft countries toward nerve grief duty rivals.

@@begin|format:javascript@@
    alert((function() {
      var item = 'item01';
      return item.split('').reverse()
    })());
@@format:python@@
    print('item01'[::-1])
@@end@@

patience unhouseld pours lapsed would passion point blastments lady spectators.

@author@ Billy Speareshakes
@title@ Thy Wonderful Randomious
@page@ 728
@footnote|78@ nose thee something disclaiming wrung antiquity rend illume halt osric list
@_created@ 2016-07-27T19:38:10Z
@_modified@ 2016-07-27T19:38:10Z

There are two paragraphs, followed by a block of JavaScript, then a block of Python, then another paragraph, then a bunch of metadata. It's a rediclous example because it combines concepts from both research website (citations and footnotes) and my netfxharmonics.com website (the javascript section, which in that context in final rendering would be rendered with JavaScript colored syntax).

The current project reads that file as the following object:

{
    '_': {
        0: 'hollow unbraced needs mineral high fingerd strings red tragical having definement invisible@@footnote|78@@. flames grow pranks obey hearsed variable grandsire bodykins possessd worser oerthrown oerweigh healthful kingly wise faculty loggats best.\n\nunfortified chopine hill witchcraft countries toward nerve grief duty rivals.',
        1: {
            0: {
                '_': "    alert((function() {\n      var item = 'item01';\n      return item.split('').reverse()\n    })());",
                'format': 'javascript'
            },
            1: {
                '_': "    print('item01'[::-1])",
                'format': 'python'
            }
        },
        2: 'patience unhouseld pours lapsed would passion point blastments lady spectators.',
    },
    'author': 'Billy Speareshakes',
    'title': 'Thy Wonderful Randomious',
    'page': '728',
    'footnote': {
        78: 'nose thee something disclaiming wrung antiquity rend illume halt osric list',        
    },
    '_created': '2016-07-27T19:38:10Z',
    '_modified': '2016-07-27T19:38:10Z',
    '_filename': 'item01.txt',
    '_extension': 'txt',
    '_basename': 'item01',
}

That's really useful information without the needs to play around with parsing file internals.

The created, modified, filename, extension, and basename are read from the file metadata, but created and modified can be overwritten using @_created@ and @_modified@ tokens.

But, it's not just metadata. On my technical website, I require color syntax for various programming languages. Preformatting makes the code unreadable. So, I need sections(@@begin...@@/@@end@@. On my research website, I require extensive citations and footnotes. So, I need linkable content (@@XXXX@@).

See test_read.py for usage.

Use Cases

  • one entry == blog entry
  • one entry == one quote (with citation data)
  • one entry == one podcast mp3; you would use something like @audio@ which would tell your custom system that this entry is describing that particular mp3