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

@paulwib/note-link-janitor

v0.0.5

Published

This script reads in a folder of Markdown files, notes all the [[wiki-style links]] between them, then adds a special "backlinks" section which lists passages which reference a given file.

Downloads

11

Readme

note-link-janitor

This script reads in a folder of Markdown files, notes all the [[wiki-style links]] between them, then adds a special "backlinks" section which lists passages which reference a given file.

For example, this text might get added to Sample note.md:

## Backlinks
* [[Something that links here]]
    * The block of text in the referencing note which contains the link to [[Sample note]].
    * Another block in that same note which links to [[Sample note]].
* [[A different note that links here]]
    * This is a paragraph from another note which links to [[Sample note]].

The script is idempotent; on subsequent runs, it will update that backlinks section in-place.

The backlinks section will be initially inserted at the end of the file. If there happens to be a HTML-style <!-- --> block at the end of your note, the backlinks will be inserted before that block.

Assumptions/warnings

  1. Links are formatted [[like this]].
  2. Note titles are inferred from the first line of each note, which is assumed to be formatted as a heading, i.e. # Note title.
  3. All .md files are siblings; the script does not currently recursively traverse subtrees (though that would be a simple modification if you need it; see lib/readAllNotes.ts)
  4. The backlinks "section" is defined as the AST span between ## Backlinks and the next heading tag (or <!-- --> tag). Any text you might add to this section will be clobbered. Don't append text after the backlinks list without a heading in between! (I like to leave my backlinks list at the end of the file)

This is FYI-style open source

This is FYI-style open source. I'm sharing it for interested parties, but without any stewardship commitment. Assume that my default response to issues and pull requests will be to ignore or close them without comment. If you do something interesting with this, though, please let me know.

Usage

To install a published release, run:

yarn global add @andymatuschak/note-link-janitor

Then to run it (note that it will modify your .md files in-place; you may want to make a backup!):

note-link-janitor path/to/folder/containing/md/files

That will run it once; you'll need to create a cron job or a launch daemon to run it regularly.

It's built to run against Node >=12, so you may need to upgrade or swap your runtime version.

Building a local copy

yarn install
yarn run build

Future work

In the future, I intend to expand this project to monitor for broken links, orphans, and other interesting hypertext-y predicates.