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

highmark-yapp

v2.0.71

Published

Highmark with Yapp listings.

Downloads

866

Readme

Highmark Yapp

Highmark with Yapp listings.

This package augments the HTML created with Highmark with Yapp listings. The result is much more pleasing to the eye. See the Juxtapose site, for example, which makes use of this package:

https://juxtapose.info

Using Highmark for creating HTML for websites usually works extremely well and even if you do not intend to include any listings, this package provides the easiest means to make use of Highmark to this end.

Contents

Introduction

Highmark is a document preparation system inspired by Markdown and TeX. There are several packages in the distribution.

Only the CLI tool is needed by end users. All of the other packages are likely only of interest to prospective developers.

Installation

If you would like to contribute or would simply like to have a look at the code, you can clone the repository with Git...

git clone https://github.com/djalbat/highmark-yapp.git

...and then install the dependencies with npm from within the project's root directory:

npm install

Example

There is a small development server that can be run from within the project's directory with the following command:

npm start

The example will then be available at the following URL:

http://localhost:8888

The source for the example can be found in the src/example.js file and correspondingsrc/example folder. You are encouraged to try the example whilst reading what follows. You can rebuild it on the fly with the following command:

npm run watch-debug

The development server will reload the page whenever you make changes.

One last thing to bear in mind is that this package is included by way of a relative rather than a package import. If you are importing it into your own application, however, you should use the standard package import.

Usage

To begin with, in order to make use of Yapp you must render the requisite styles:

import { renderYappStyles } from "highmark-yapp";

renderYappStyles();

...

Next, to create a node from some Markdown content, use the tokensFromContent() and nodeFromTokens() utility functions:

import { markdownUtilities } from "highmark-yapp";

const { tokensFromContent, nodeFromTokens } = markdownUtilities;

const content = `

        ...
        
      `,
      tokens = tokensFromContent(node),
      node = nodeFromTokens(tokens);

Then it is just a question of mounting the node:

const body = document.querySelector("body"),
      domElement = body,  ///
      parentDOMElement = domElement,  ///
      siblingDOMElement = null,
      context = {
        tokens
      };

node.mount(parentDOMElement, siblingDOMElement, context);

Note the use of the tokens in a context plain old JavaScript object that must be padded to the node's mount() method along with the parent and sibling DOM elements. This is why there are two utility functions to create the node in two stages. By the way, the sibling DOM element, if not null, must be a child of the parent DOM element, in which case the node will be mounted immediately before it.

Note also that the usual delimiters for block listings consisting of three backticks have been replaced with three single quotes '''. This generally makes things easier when working inside string template literals that use backticks for delimiters.

Building

Automation is done with npm scripts, have a look at the package.json file. The pertinent commands are:

npm run build-debug
npm run watch-debug

Contact