New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

sun-termstyle

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sun-termstyle

a helper to make your terminal better

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

termstyle

termstyle 是一个用于将 Markdown 风格文本编译为终端 ANSI 彩色/样式输出的 TypeScript/Node.js 工具库。

特性

  • 支持 Markdown 常用样式(粗体、斜体、删除线、代码高亮等)到终端 ANSI 转义序列的转换
  • 支持多层嵌套样式
  • 提供自定义错误类型,便于调试和扩展
  • 兼容 Node.js 环境

安装

npm install termstyle

快速开始

const termstyle = require('termstyle');

// Markdown 转终端彩色字符串
console.log(termstyle.parseMd('**加粗** *斜体* `代码`'));
//或直接读取md文档
const md=termstyle.readMd(__datapath,'readme')
console.log(md)

// 直接使用 ansi 工具
console.log(termstyle.ansi.red('红色文字'));

API

parseMd(str: string): string

将 Markdown 风格字符串编译为带有 ANSI 样式的终端字符串。

ansi

常用 ANSI 样式方法和常量集合。

错误类型

  • TermStyleError
  • InvalidStyleError
  • ParseMdError

进阶用法

  • 支持自定义样式表
  • 支持读取 .md 文件并渲染到终端

贡献

欢迎 issue 和 PR!

License

MIT

Keywords

terminal

FAQs

Package last updated on 31 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts