New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kaciras-blog/markdown

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kaciras-blog/markdown - npm Package Compare versions

Comparing version 2.4.1 to 3.0.0

lib/collapsible.d.ts

130

lib/index.js

@@ -1,72 +0,62 @@

import FootnoteRaw from "markdown-it-footnote";
import AnchorRaw from "markdown-it-anchor";
export { default as TOC } from "markdown-it-toc-done-right";
export * from "./media.js";
export { default as Collapsible } from "./collapsible.js";
export { default as UGC } from "./ugc.js";
export { default as Media } from "./media.js";
/**
* 给标题加上锚点,是对 markdown-it-anchor 的简单封装。
*/
export function Anchor(markdownIt) {
markdownIt.use(AnchorRaw, {
permalink: AnchorRaw.permalink.linkInsideHeader({
placement: "after",
class: "anchor-link",
}),
slugify: title => title.trim().toLowerCase().replace(/\s+/g, "-"),
});
import { A as C, a as g, C as b, D as v, F as p, M as A, U as w, c as D, d as F, h as G } from "./highlight-e14f2255.js";
import { activate as T } from "./web/activate.js";
import { default as y } from "markdown-it-toc-done-right";
import { f as I } from "./fence-30cfdf9c.js";
var u = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.Italic = 1] = "Italic", e[e.Bold = 2] = "Bold", e[e.Code = 4] = "Code", e[e.StrikeThrough = 8] = "StrikeThrough", e))(u || {});
function k(e) {
let n = 0, t = 0, o = e.length - 1, r = 0, c = e.charCodeAt(0);
if (o < 1)
return [0, 0];
function i() {
return c === 126 && r === 2 ? 8 : c === 96 && r > 0 ? 4 : c !== 42 && c !== 95 ? 0 : r === 1 ? 1 : r === 2 ? 2 : 3;
}
for (; t < o; t++, o--, r++) {
const a = e.charCodeAt(t);
if (a !== e.charCodeAt(o))
break;
if (a !== c) {
const f = i();
if (f === 0)
break;
r = 0, c = a, n |= f;
}
}
const l = i();
return [n | l, l === 0 ? t - r : t];
}
/**
* 添加脚注功能,就是像论文一样的上角标引用。
*
* 因为可能用于评论,所以修改渲染函数去掉横线,避免跟评论间的分隔混淆。
* 可以通过 md.render 的第二个参数中添加 docId 来给锚点添加前缀,避免重复。
*
* @see https://www.markdownguide.org/extended-syntax/#footnotes
*/
export function Footnote(markdownIt) {
markdownIt.use(FootnoteRaw);
const { rules } = markdownIt.renderer;
rules.footnote_block_open = () => ("<h2 class='footnotes'>参考</h2>" +
"<ol class='footnotes-list'>");
rules.footnote_block_close = () => "</ol>";
function s(e, n) {
function t(o) {
for (const r of o)
switch (r.type) {
case "inline":
t(r.children);
break;
case "link_open":
case "directive":
n(r.attrGet("href"));
break;
case "image":
n(r.attrGet("src"));
break;
}
}
e.core.ruler.push("collect-links", (o) => t(o.tokens));
}
/**
* 给行内代码加个 inline-code 类以便跟代码块区别开。
*/
export function Classify(markdownIt) {
const { rules } = markdownIt.renderer;
const raw = rules.code_inline;
rules.code_inline = (tokens, idx, options, env, self) => {
const token = tokens[idx];
token.attrPush(["class", "inline-code"]);
return raw(tokens, idx, options, env, self);
};
}
/**
* 检查文本中所有文件链接的插件,文件链接包括链接的 href,以及媒体的源。
*
* @param markdownIt 要安装到的 MarkdownIt 对象。
* @param handler 找到的链接将传递给这个函数。
*/
export function CollectLinks(markdownIt, handler) {
function check(tokens) {
for (const token of tokens) {
switch (token.type) {
case "inline":
check(token.children);
break;
case "link_open":
case "media":
handler(token.attrGet("href"));
break;
case "image":
handler(token.attrGet("src"));
break;
}
}
}
markdownIt.core.ruler.push("collect-links", s => check(s.tokens));
}
//# sourceMappingURL=index.js.map
export {
C as Anchor,
g as Classify,
b as Collapsible,
s as Collect,
v as Directive,
u as Emphasis,
I as Fence,
p as Footnote,
A as Media,
y as TOC,
w as UGC,
T as activate,
D as checkLink,
F as defaultDirectiveMap,
k as getEmphasis,
G as highlight
};
{
"name": "@kaciras-blog/markdown",
"version": "2.4.1",
"description": "Markdown-it plugins for Kaciras Blog",
"version": "3.0.0",
"license": "MIT",
"description": "Kaciras Flavored Markdown",
"author": "Kaciras <Kaciras@outlook.com>",
"repository": {
"type": "git",
"url": "https://github.com/kaciras-blog/web-server",
"directory": "packages/markdown"
"url": "https://github.com/kaciras-blog/markdown",
"directory": "core"
},
"engines": {
"node": ">=18"
"exports": {
".": "./lib/index.js",
"./activate": "./lib/web/activate.js",
"./presets": "./lib/presets.js",
"./style.css": "./lib/style.css"
},
"type": "module",
"main": "lib/index.js",
"files": [

@@ -20,2 +22,6 @@ "lib"

"dependencies": {
"@kaciras/utilities": "^0.10.1",
"bootstrap-icons": "^1.11.0",
"highlight.js": "^11.8.0",
"markdown-it": "^13.0.1",
"markdown-it-anchor": "^8.6.7",

@@ -26,5 +32,19 @@ "markdown-it-footnote": "^3.0.3",

"devDependencies": {
"@types/markdown-it": "^12.2.3",
"markdown-it": "^13.0.1"
"@types/html-minifier-terser": "^7.0.0",
"@types/markdown-it": "^13.0.1",
"@vitest/coverage-v8": "^0.34.4",
"html-minifier-terser": "^7.2.0",
"magic-string": "^0.30.3",
"postcss-nested": "^6.0.1",
"postcss-simple-vars": "^7.0.1",
"vite": "^4.3.9",
"vitest": "^0.34.4"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "vite build && tsc --project ./tsconfig.types.json",
"test": "vitest run"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc