npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

modell-markedjs-plus

v0.0.7-1

Published

a myarkedjs powerdup plugs custom extensions.

Downloads

217

Readme

说明

因为 markedjs 只有基础功能,不支持很多高级功能,所以只能自己动手造轮子了。

功能

1. 修改图片的显示方式

输入

![图片标题](图片1的地址|对齐)

输出

<div align="对齐">
<div><img src="图片1的地址"></div>
<div>图 1:图片标题</div>
</div>

如果图片标题不输入,则不显示图片标题,只显示 图 1

默认为 left 。 有 left 、right 、center 、justify 可选。

2. 图片引用

当输入 @[image]{图片标题} 的时候,就可以展现为图片的引用。

输入

@[image]{图片标题}

输出

<span>图 1</span>

如果当写图片时放括号内没有写图片标题(![](/pic/addr.jpg)),这在引用时,需要使用图片地址。

如:

@[image]{/pic/addr.jpg}

3. 标题

当输入 # 符号时,会判断是几重标题,并输出对应的内容。
仅当输入 # 时有效。

输入

# 第一段
## 第一段第一章
### 第一段第一章第一节
### 第一段第一章第二节
#### 第一段第一章第一节第一小节
#### 第一段第一章第一节第二小节
## 第一段第二章
### 第一段第二章第一节
### 第一段第二章第二节
### 第一段第一章第三节
#### 第一段第二章第三节第一小节
#### 第一段第二章第三节第二小节
### 第一段第二章第三节
# 第二段

输出

1. 第一段
1.1. 第一段第一章
1.1.1. 第一段第一章第一节
1.1.2. 第一段第一章第二节
1.1.2.1. 第一段第一章第一节第一小节
1.1.2.2. 第一段第一章第一节第二小节
1.2. 第一段第二章
1.2.1. 第一段第二章第一节
1.2.2. 第一段第二章第二节
1.2.3. 第一段第一章第二节
1.2.3.1. 第一段第二章第三节第一小节
1.2.3.1. 第一段第二章第三节第二小节
1.2.4. 第一段第二章第三节
2. 第二段

4. 表格的题注和引用

4.1. 题注

在表格后面加入,可以显示为表格的题注。
表格的名称可以用任意字符。

输入

@[table]{:表的名称}

输出

<div>表 1</div>

4.2. 引用

在任意位置输入,可以引用表格。

输入

@[table]{表的名称}

输出

<span>表 1</span>

4.3. 颜色

输入

#[FF0000]{这里是红字}

输出

<span style="color:#FF0000;">这里是红字</span>

API

全局对象

| API | 说明 | 参数 | 返回值 | | --- | --- | --- | --- | | parse | 不适用扩展功能,直接使用 markedjs 的原生处理 | markDownString | html | | create | 创建一个 modell-markedjs-plus 的新实例 | 无 | modell-markedjs-plus 的新实例 |

modell-markedjs-plus 实例

| API | 说明 | 参数 | 返回值 | | --- | --- | --- | --- | | parse | 解析 markdown | markDownString | html | | addCustomExtension | 添加自定义 customExtension | object | 无 | | getLexer | 获得 lexer 的实例 | 无 | lexer 实例 | | getParser | 获得 parser 的实例 | 无 | parser 实例 | | getRenderer | 获得 renderer 的实例 | 无 | renderer 实例 | | setFileDefaultUrl | 设置文件解析默认路径有这个路径则以这个路径+md的定义进行解析如果没有,则仅按 md 中的内容进行解析 | 路径 | 无 | | setImageDefaultAlign | 设置图片默认对齐方案如果md中有定义,则按md中的定义解析,如果没有则按这里的解析,默认居左 | 对齐方式 | 无 |

使用方式

const { Marked } = require("marked");

const plusInstance = plus(Marked);
const object = plusInstace.create();
object.parse(markdownString);