@velin-dev/utils
v1.0.0-beta.8
Published
Develop prompts with Vue SFC or Markdown like pro.
Readme
@velin-dev/utils
Refer to README.md for more information.
Custom tags in prompts
toMarkdown() converts standard HTML elements to Markdown and preserves other
element tags and their attributes. The standard tag list comes from
html-tags, which excludes obsolete
HTML tags. Standard HTML inside custom elements is still converted:
import { toMarkdown } from '@velin-dev/utils/to-md'
await toMarkdown('<instructions priority="high"><strong>Be concise</strong></instructions>')
// <instructions priority="high">**Be concise**</instructions>This also applies to the Vue, React, and Markdown prompt renderers, which share
the same conversion. Existing handling of standard elements, such as removing
script and style, still applies. Vue SFC compilation may warn about unresolved
custom elements; preserving tags in the output does not change component resolution.
The input is parsed as HTML, not XML: tag and attribute casing, whitespace, and entity spelling can be normalized. Write custom elements with explicit closing tags when providing HTML or Markdown source; HTML parsing does not recognize XML self-closing syntax for these elements. Vue/JSX self-closing elements are expanded by the component renderer before conversion. XML declarations and CDATA are not supported as XML syntax.
License
MIT
