HTML Inline Text Plugin
A plugin for staticbolt that inlines external text files into the HTML at build time.
Installation
The plugin ships as part of @staticbolt/core. You do not need to install another package.
Usage
In your .staticbolt.ts configuration file:
import { defineConfig } from "@staticbolt/core";import { htmlInlineTextPlugin } from "@staticbolt/core/plugins";
export default defineConfig({ plugins: [htmlInlineTextPlugin()],});Inlining a text file
Add an <inline-text src="..."> tag anywhere in your HTML. At build time the plugin reads the file and puts its content in place of the tag, HTML-escaped.
<inline-text src="./content.txt"></inline-text>Plugin Options
tagName
- Type:
string - Default:
"inline-text"
The custom tag name that the plugin looks for when it scans the HTML.
htmlInlineTextPlugin({ tagName: "text-embed",});sourceAttribute
- Type:
string - Default:
"src"
The attribute on the custom tag that holds the path to the external text file.
htmlInlineTextPlugin({ sourceAttribute: "href",});noEscapeAttribute
- Type:
string - Default:
"no-escape"
The attribute on the custom tag that turns off HTML escaping for the content.
htmlInlineTextPlugin({ noEscapeAttribute: "no-escape",});