open-index/open-npm huggingface dataset:
npm package: @prpl/core
Description: HTML-based static site generator
Author: Ty Hopp
Latest version: 0.4.0

# @prpl/core

This module interpolates your content into HTML.

## Usage

Can be used via the `prpl` CLI command, or in CJS/ESM. Example in ESM:

```javascript
import { interpolate } from '@prpl/core';

// Default options
const options = {
  noClientJS: false,
  templateRegex: (key) => new RegExp(`\\[${key}\\]`, 'g'),
  markedOptions: {}
};

async function build() {
  await interpolate({ options });
}

build();
```

## Dependencies

`@prpl/core` has one dependency: [`marked`](https://github.com/markedjs/marked), a markdown compiler. Reasons 
for relying on it include:

- It is not practical to implement a markdown compiler within the PRPL library
- It is fair to assume that most users will author content in markdown given its ubiquity  
- [`marked`](https://github.com/markedjs/marked) itself has zero dependencies and is actively maintained

In the future it may make sense to externalize this dependency, but given the above reasons it is included for now.
npm package: @prpl/plugin-cache
Description: PRPL plugin for cache manipulation
Author: Ty Hopp
Latest version: 0.3.0

# @prpl/plugin-cache (WIP)

**NOTE - This plugin is experimental. It may change significantly in the future. Not recommended for use at present.**

A plugin for [PRPL](https://github.com/tyhopp/prpl) for cache manipulation. Useful for defining cache partitions that 
subsequent plugins may access.

## Dependencies

`@prpl/plugin-cache` has zero dependencies.

## Usage

For example, you may want to pre-define a partition that reads all HTML and CSS files in `dist` so that those files 
can be accessed in memory:

```javascript
import { resolve } from 'path';
import { interpolate, PRPLCachePartitionKey } from '@prpl/core';
import { createCachePartition } from '@prpl/plugin-cache';
import { resolveHTMLImports } from '@prpl/plugin-html-imports';
import { resolveCSSImports } from '@prpl/plugin-css-imports';

await interpolate();

// Pre-define dist partition and use for subsequent plugins
await createCachePartition({
  entityPath: resolve('dist'),
  partitionKey: PRPLCachePartitionKey.dist,
  readFileRegExp: new RegExp(`.html|.css`)
});

await resolveHTMLImports({
  cachePartitionKey: PRPLCachePartitionKey.dist
});

await resolveCSSImports({
  cachePartitionKey: PRPLCachePartitionKey.dist
});
```

By doing this, we save each plugin from generating its own partition that reads from the file system. All plugins 
that interact with the cache should return the cache as an artifact that can be conveniently inspected.
npm package: @prpl/plugin-code-highlight
Description: PRPL plugin that highlights code blocks with Highlight.js
Author: Ty Hopp
Latest version: 0.4.0

# @prpl/plugin-code-highlight

A plugin for [PRPL](https://github.com/tyhopp/prpl) that highlights code blocks with [Highlight.js](https://github.com/highlightjs/highlight.js).

## Dependencies

`@prpl/plugin-code-highlight` has two dependencies, [highlight.js](https://github.com/highlightjs/highlight.js) and 
[html-escaper](https://github.com/WebReflection/html-escaper).

## Usage

```javascript
import { interpolate } from '@prpl/core';
import { highlightCode } from '@prpl/plugin-code-highlight';

await interpolate();
await highlightCode();
```

### Notes

This plugin **does not include any CSS**. It processes code blocks given the specified syntax (e.g., JavaScript, 
Python) and outputs DOM structures in place that are possible to style with CSS.

`<code>` elements are expected to have a `language-*` class with [languages supported by Highlight.js](https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md).

If you're writing in HTML you can write your blocks like this: 
```javascript
<pre>
  <code class="language-javascript">console.log('Hello world!');</code>
</pre>
```

If you're writing in markdown you can write your blocks like this:

````
```javascript
console.log('Hello world!');
```
````

See [the default CSS stylesheet](https://github.com/highlightjs/highlight.js/blob/main/src/styles/default.css) for 
an example of how to style Highlight.js processed DOM structures.
npm package: @prpl/plugin-css-imports
Description: PRPL plugin that resolves CSS imports at build time
Author: Ty Hopp
Latest version: 0.3.0

# @prpl/plugin-css-imports

A plugin for [PRPL](https://github.com/tyhopp/prpl) that resolves CSS import statements at build time. Useful to 
avoid extra requests at runtime for imported CSS files.

This plugin should be disabled when using the PRPL dev server. The dev server is not yet aware of the graph of resources in your site and will not be able to detect changes in imported CSS files. There should be no difference in behavior given the [CSS at-rule](https://caniuse.com/?search=css%20import) is supported in all modern browsers.

## Dependencies

`@prpl/plugin-css-imports` has zero dependencies.

### Usage

```javascript
import { interpolate } from '@prpl/core';
import { resolveCSSImports } from '@prpl/plugin-css-imports';

await interpolate();
await resolveCSSImports();
```

### Notes

Given CSS file `a.css`:

```css
@import 'b.css';

h1 {
  color: mediumslateblue;
}
```

and CSS file `b.css`:

```css
p {
  color: mediumslateblue;
}
```

and [`resolveCSSImports`](https://github.com/tyhopp/prpl/tree/main/packages/plugin-css-imports/src/index.ts) is called, the output of CSS file `a.css` will be:

```css
p {
  color: mediumslateblue;
}

h1 {
  color: mediumslateblue;
}
```
npm package: @prpl/plugin-html-imports
Description: PRPL plugin that resolves HTML imports at build time
Author: Ty Hopp
Latest version: 0.3.0

# @prpl/plugin-html-imports

A plugin for [PRPL](https://github.com/tyhopp/prpl) that resolves HTML import statements at build time.

The PRPL dev server is not yet aware of the graph of resources in your site and will not be able to detect changes in imported HTML files. Given that [HTML imports](https://caniuse.com/?search=html%20import) is a deprecated specification, it's recommended to only use this plugin for fragments of HTML that you do not need live reloads of during development (for example, meta tags).

## Dependencies

`@prpl/plugin-html-imports` has zero dependencies.

### Usage

```javascript
import { interpolate } from '@prpl/core';
import { resolveHTMLImports } from '@prpl/plugin-html-imports';

await interpolate();
await resolveHTMLImports();
```

### Notes

Given HTML file `hello-world.html`:

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <base href="/" />
    <link rel="import" href="meta.html" />
    <title>Hello world</title>
  </head>
  <body>
    <main class="index">
      <h1>Hello world</h1>
    </main>
  </body>
</html>
```

and an HTML fragment `meta.html`:

```html
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
```

and [`resolveHTMLImports`](https://github.com/tyhopp/prpl/tree/main/packages/plugin-html-imports/src/index.ts) is called, the output of HTML file `hello-world.html` will be:

```html
<html lang="en">
  <head>
    <base href="/" />
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
    <title>Hello world</title>
  </head>
  <body>
    <main class="index">
      <h1>Hello world</h1>
    </main>
  </body>
</html>
```
npm package: @prpl/plugin-rss
Description: PRPL plugin that generates an Atom RSS feed
Author: Ty Hopp
Latest version: 0.3.0

# @prpl/plugin-rss

A plugin for [PRPL](https://github.com/tyhopp/prpl) that generates [Atom feeds](https://en.wikipedia.org/wiki/Atom_
(Web_standard)).

## Dependencies

`@prpl/plugin-rss` has zero dependencies.

### Usage

```javascript
import { interpolate } from '@prpl/core';
import { generateRSSFeed } from '@prpl/plugin-rss';

await interpolate();
await generateRSSFeed({
  dir: 'content/notes',
  feedTitle: `Ty Hopp's Feed`,
  author: 'Ty Hopp',
  origin: 'https://tyhopp.com'
});
```
npm package: @prpl/plugin-sitemap
Description: PRPL plugin that generates a sitemap
Author: Ty Hopp
Latest version: 0.2.0

# @prpl/plugin-sitemap

A plugin for [PRPL](https://github.com/tyhopp/prpl) that generates a sitemap.

## Dependencies

`@prpl/plugin-sitemap` has zero dependencies.

## Usage

```javascript
import { interpolate, PRPLCachePartitionKey } from '@prpl/core';
import { generateSitemap } from '@prpl/plugin-sitemap';

await interpolate();
await generateSitemap({
  origin: 'https://tyhopp.com',
  ignoreDirRegex: new RegExp('dist/fragments'),
});
```
npm package: @prpl/server
Description: Development server for PRPL
Author: Ty Hopp
Latest version: 0.2.0

# @prpl/server

Development server that watches local file changes and makes those updates in the browser. Usage with `@prpl/core` 
is optional.

## Dependencies

[`@prpl/server`](https://github.com/tyhopp/prpl/tree/main/packages/server/src/server.ts) is the only module with more than a couple dependencies:

- [chokidar](https://github.com/paulmillr/chokidar) for watching file system changes
- [faye-websocket](https://github.com/faye/faye-websocket-node) as a websocket interface on the client and server
- [open](https://www.npmjs.com/package/open) to open the project in the browser
- [serve-handler](https://github.com/vercel/serve-handler) for routing requests and handling responses

## Usage

Run `prpl-server` from the command line in the root of your project.