A simple utility for wrapping text in various formats, including XML, Markdown, HTML, JSON, YAML, CSV, Plain Text, LaTeX, and Shell.
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers
JSR Score
94%
Published
a week ago (0.1.0)
Fence Wrapper
A simple utility for wrapping text in various formats, including XML, Markdown, HTML, JSON, YAML, CSV, Plain Text, LaTeX, and Shell.
The point of this is to have a single function that can wrap text in various formats, for templating text as prompts to various LLMs. E.g. Claude prefers xml, while OpenAI prefers markdown.
Installation
To use this utility, you can import it into your Deno project:
## Usage The `wrapText` function takes three parameters: - `text` (string): The text to be wrapped. - `tag` (string): The tag to wrap the text with. - `type` (string, optional): The type of wrapping to apply. Defaults to `"xml"`. Supported types are: - `"xml"` - `"markdown"` - `"html"` - `"json"` - `"yaml"` - `"csv"` - `"plain"` - `"latex"` - `"shell"` ### Example ```ts import wrapText from "jsr:@yawnxyz/fence"; const wrappedText = wrapText("Hello, World!", "greeting", "markdown"); console.log(wrappedText); // Output: ```greeting\nHello, World!\n```
License
This project is licensed under the MIT License.
Add Package
deno add @yawnxyz/fence
Import symbol
import * as mod from "@yawnxyz/fence";
---- OR ----
Import directly with a jsr specifier
import * as mod from "jsr:@yawnxyz/fence";
Add Package
npx jsr add @yawnxyz/fence
Import symbol
import * as mod from "@yawnxyz/fence";
Add Package
yarn dlx jsr add @yawnxyz/fence
Import symbol
import * as mod from "@yawnxyz/fence";
Add Package
pnpm dlx jsr add @yawnxyz/fence
Import symbol
import * as mod from "@yawnxyz/fence";
Add Package
bunx jsr add @yawnxyz/fence
Import symbol
import * as mod from "@yawnxyz/fence";