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

antora-site-generator-lunr

v0.6.1

Published

An Antora's site generator that produces a Lunr index.

Downloads

7,872

Readme

Antora Site Generator With Lunr

npm Build

This site generator is a copy of the default site generator that in addition produces a Lunr index that can be used in your documentation UI. Lunr provides a great search experience in your documentation site without the need for external, server-side, search services.

Antora is a modular static site generator designed for creating documentation sites from AsciiDoc documents. Its site generator pipeline aggregates documents from versioned content repositories and processes them using Asciidoctor.

Usage

Install the site generator. Open a terminal and type:

$ npm i -g antora-site-generator-lunr

When generating your documentation site, use the --generator option:

$ DOCSEARCH_ENABLED=true DOCSEARCH_ENGINE=lunr NODE_PATH="$(npm -g root)" antora --generator antora-site-generator-lunr site.yml

NOTE: The NODE_PATH assignment is necessary to ensure Antora can locate node modules install globally. Depending on your environment, you may find that this assignment is unnecessary. If you've installed Antora globally using Yarn, you may need to add "$(yarn global dir)/node_modules" to the NODE_PATH environment variable instead.

Please read the documentation to enable the search component in your documentation UI.

Using the Docker image

The Docker image is built upon the Antora's official Docker image and should be used as a replacement. For example, instead of running:

$ docker run -u $(id -u) -v $PWD:/antora:Z --rm -t antora/antora:2.3.4 antora-playbook.yml

You will run:

$ docker run -u $(id -u) -v $PWD:/antora:Z --rm -t ggrossetie/antora-lunr antora-playbook.yml

The image sets DOCSEARCH_ENABLED=true and DOCSEARCH_ENGINE=lunr environment variables. When executing docker run, you can overwrite any variable defined in the image. For example:

$ docker run --env DOCSEARCH_ENABLED=false # ...

Moreover, the site generator is automatically configured on the antora command (i.e. --generator antora-site-generator-lunr).

Upgrading

When installing this generator globally (i.e., npm i -g), it also installs a private copy of Antora (minus the CLI). Thus, to upgrade the copy of Antora this site generator uses, you need to reinstall this package. Upgrading Antora alone isn't sufficient.

To upgrade this site generator and Antora, open a terminal and type the following commands:

$ npm uninstall -g antora-site-generator-lunr @antora/cli @antora/site-generator-default

$ npm i -g antora-site-generator-lunr @antora/cli @antora/site-generator-default

These commands ensure you have the latest version of both the site generator and Antora regardless of whether you're using this site generator.