@cnblogs/markdown-it-presets 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitignore +195 -0
- package/README.adoc +80 -0
- package/math/package.json +8 -0
- package/package.json +106 -0
- package/tsconfig.base.json +17 -0
- package/tsconfig.json +4 -0
- package/tslint.json +18 -0
package/.gitignore
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
|
|
2
|
+
# Created by https://www.gitignore.io/api/node
|
|
3
|
+
# Edit at https://www.gitignore.io/?templates=node
|
|
4
|
+
out-tsc/
|
|
5
|
+
temp/
|
|
6
|
+
### Node ###
|
|
7
|
+
# Logs
|
|
8
|
+
logs
|
|
9
|
+
*.log
|
|
10
|
+
npm-debug.log*
|
|
11
|
+
yarn-debug.log*
|
|
12
|
+
yarn-error.log*
|
|
13
|
+
lerna-debug.log*
|
|
14
|
+
|
|
15
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
16
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
17
|
+
|
|
18
|
+
# Runtime data
|
|
19
|
+
pids
|
|
20
|
+
*.pid
|
|
21
|
+
*.seed
|
|
22
|
+
*.pid.lock
|
|
23
|
+
|
|
24
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
25
|
+
lib-cov
|
|
26
|
+
|
|
27
|
+
# Coverage directory used by tools like istanbul
|
|
28
|
+
coverage
|
|
29
|
+
*.lcov
|
|
30
|
+
|
|
31
|
+
# nyc test coverage
|
|
32
|
+
.nyc_output
|
|
33
|
+
|
|
34
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
35
|
+
.grunt
|
|
36
|
+
|
|
37
|
+
# Bower dependency directory (https://bower.io/)
|
|
38
|
+
bower_components
|
|
39
|
+
|
|
40
|
+
# node-waf configuration
|
|
41
|
+
.lock-wscript
|
|
42
|
+
|
|
43
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
44
|
+
build/Release
|
|
45
|
+
|
|
46
|
+
# Dependency directories
|
|
47
|
+
node_modules/
|
|
48
|
+
jspm_packages/
|
|
49
|
+
|
|
50
|
+
# TypeScript v1 declaration files
|
|
51
|
+
typings/
|
|
52
|
+
|
|
53
|
+
# TypeScript cache
|
|
54
|
+
*.tsbuildinfo
|
|
55
|
+
|
|
56
|
+
# Optional npm cache directory
|
|
57
|
+
.npm
|
|
58
|
+
|
|
59
|
+
# Optional eslint cache
|
|
60
|
+
.eslintcache
|
|
61
|
+
|
|
62
|
+
# Optional REPL history
|
|
63
|
+
.node_repl_history
|
|
64
|
+
|
|
65
|
+
# Output of 'npm pack'
|
|
66
|
+
*.tgz
|
|
67
|
+
|
|
68
|
+
# Yarn Integrity file
|
|
69
|
+
.yarn-integrity
|
|
70
|
+
|
|
71
|
+
# dotenv environment variables file
|
|
72
|
+
.env
|
|
73
|
+
.env.test
|
|
74
|
+
|
|
75
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
76
|
+
.cache
|
|
77
|
+
|
|
78
|
+
# next.js build output
|
|
79
|
+
.next
|
|
80
|
+
|
|
81
|
+
# nuxt.js build output
|
|
82
|
+
.nuxt
|
|
83
|
+
|
|
84
|
+
# react / gatsby
|
|
85
|
+
public/
|
|
86
|
+
|
|
87
|
+
# vuepress build output
|
|
88
|
+
.vuepress/dist
|
|
89
|
+
|
|
90
|
+
# Serverless directories
|
|
91
|
+
.serverless/
|
|
92
|
+
|
|
93
|
+
# FuseBox cache
|
|
94
|
+
.fusebox/
|
|
95
|
+
|
|
96
|
+
# DynamoDB Local files
|
|
97
|
+
.dynamodb/
|
|
98
|
+
|
|
99
|
+
# End of https://www.gitignore.io/api/node
|
|
100
|
+
|
|
101
|
+
# Created by https://www.gitignore.io/api/jetbrains
|
|
102
|
+
# Edit at https://www.gitignore.io/?templates=jetbrains
|
|
103
|
+
|
|
104
|
+
### JetBrains ###
|
|
105
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
|
106
|
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
107
|
+
|
|
108
|
+
# User-specific stuff
|
|
109
|
+
.idea/**/workspace.xml
|
|
110
|
+
.idea/**/tasks.xml
|
|
111
|
+
.idea/**/usage.statistics.xml
|
|
112
|
+
.idea/**/dictionaries
|
|
113
|
+
.idea/**/shelf
|
|
114
|
+
|
|
115
|
+
# Generated files
|
|
116
|
+
.idea/**/contentModel.xml
|
|
117
|
+
|
|
118
|
+
# Sensitive or high-churn files
|
|
119
|
+
.idea/**/dataSources/
|
|
120
|
+
.idea/**/dataSources.ids
|
|
121
|
+
.idea/**/dataSources.local.xml
|
|
122
|
+
.idea/**/sqlDataSources.xml
|
|
123
|
+
.idea/**/dynamic.xml
|
|
124
|
+
.idea/**/uiDesigner.xml
|
|
125
|
+
.idea/**/dbnavigator.xml
|
|
126
|
+
|
|
127
|
+
# Gradle
|
|
128
|
+
.idea/**/gradle.xml
|
|
129
|
+
.idea/**/libraries
|
|
130
|
+
|
|
131
|
+
# Gradle and Maven with auto-import
|
|
132
|
+
# When using Gradle or Maven with auto-import, you should exclude module files,
|
|
133
|
+
# since they will be recreated, and may cause churn. Uncomment if using
|
|
134
|
+
# auto-import.
|
|
135
|
+
# .idea/modules.xml
|
|
136
|
+
# .idea/*.iml
|
|
137
|
+
# .idea/modules
|
|
138
|
+
# *.iml
|
|
139
|
+
# *.ipr
|
|
140
|
+
|
|
141
|
+
# CMake
|
|
142
|
+
cmake-build-*/
|
|
143
|
+
|
|
144
|
+
# Mongo Explorer plugin
|
|
145
|
+
.idea/**/mongoSettings.xml
|
|
146
|
+
|
|
147
|
+
# File-based project format
|
|
148
|
+
*.iws
|
|
149
|
+
|
|
150
|
+
# IntelliJ
|
|
151
|
+
out/
|
|
152
|
+
|
|
153
|
+
# mpeltonen/sbt-idea plugin
|
|
154
|
+
.idea_modules/
|
|
155
|
+
|
|
156
|
+
# JIRA plugin
|
|
157
|
+
atlassian-ide-plugin.xml
|
|
158
|
+
|
|
159
|
+
# Cursive Clojure plugin
|
|
160
|
+
.idea/replstate.xml
|
|
161
|
+
|
|
162
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
163
|
+
com_crashlytics_export_strings.xml
|
|
164
|
+
crashlytics.properties
|
|
165
|
+
crashlytics-build.properties
|
|
166
|
+
fabric.properties
|
|
167
|
+
|
|
168
|
+
# Editor-based Rest Client
|
|
169
|
+
.idea/httpRequests
|
|
170
|
+
|
|
171
|
+
# Android studio 3.1+ serialized cache file
|
|
172
|
+
.idea/caches/build_file_checksums.ser
|
|
173
|
+
|
|
174
|
+
### JetBrains Patch ###
|
|
175
|
+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
|
176
|
+
|
|
177
|
+
# *.iml
|
|
178
|
+
# modules.xml
|
|
179
|
+
# .idea/misc.xml
|
|
180
|
+
# *.ipr
|
|
181
|
+
|
|
182
|
+
# Sonarlint plugin
|
|
183
|
+
.idea/**/sonarlint/
|
|
184
|
+
|
|
185
|
+
# SonarQube Plugin
|
|
186
|
+
.idea/**/sonarIssues.xml
|
|
187
|
+
|
|
188
|
+
# Markdown Navigator plugin
|
|
189
|
+
.idea/**/markdown-navigator.xml
|
|
190
|
+
.idea/**/markdown-navigator/
|
|
191
|
+
|
|
192
|
+
# End of https://www.gitignore.io/api/jetbrains
|
|
193
|
+
|
|
194
|
+
/dist
|
|
195
|
+
/.idea
|
package/README.adoc
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
= markdown-it-presets
|
|
2
|
+
|
|
3
|
+
== Usage
|
|
4
|
+
|
|
5
|
+
[source,bash]
|
|
6
|
+
----
|
|
7
|
+
yarn add @zeeko-myget/markdown-it-presets@latest
|
|
8
|
+
----
|
|
9
|
+
|
|
10
|
+
== Breaking Changes
|
|
11
|
+
|
|
12
|
+
=== 0.0.4
|
|
13
|
+
|
|
14
|
+
. 移除了所有的预设,必须传递完整的参数
|
|
15
|
+
. 不再支持服务端渲染数学公式结果,请在前端使用 MathJax 进行渲染
|
|
16
|
+
|
|
17
|
+
=== Node.js or javascript bundler
|
|
18
|
+
|
|
19
|
+
[source,javascript]
|
|
20
|
+
----
|
|
21
|
+
// Node.js
|
|
22
|
+
const { markdownItFactory } = require('@zeeko/markdown-it-presets');
|
|
23
|
+
|
|
24
|
+
// ECMA moudle
|
|
25
|
+
import { markdownItFactory } from '@zeeko/markdown-it-presets';
|
|
26
|
+
----
|
|
27
|
+
|
|
28
|
+
=== HTML
|
|
29
|
+
|
|
30
|
+
[source,html]
|
|
31
|
+
----
|
|
32
|
+
<!--optional start-->
|
|
33
|
+
<script src="https://path/to/highlight.js"></script>
|
|
34
|
+
<!--optional end-->
|
|
35
|
+
|
|
36
|
+
<script src="./node_modules/@zeeko-myget/markdown-it-presets/umd/markdown-it-persets.js"></script>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
const { markdownItFactory } = window.markdownItPresets;
|
|
40
|
+
</script>
|
|
41
|
+
----
|
|
42
|
+
|
|
43
|
+
== API
|
|
44
|
+
|
|
45
|
+
[source,ts]
|
|
46
|
+
----
|
|
47
|
+
markdownItFactory(opt: MarkdownItPresetsOption = defaultOption): MarkdownIt
|
|
48
|
+
----
|
|
49
|
+
|
|
50
|
+
.options
|
|
51
|
+
|===
|
|
52
|
+
| Name | Type | Description | Default value
|
|
53
|
+
|
|
54
|
+
| `codeHighlight` | Boolean | 是否使用 hljs 进行代码高亮 | `false`
|
|
55
|
+
|
|
56
|
+
| `math` | Boolean | 是否将`$`或`$$`包围的内容转换为数学公式供 MathJax 渲染 | `false`
|
|
57
|
+
|
|
58
|
+
| `disableRules` | Array<string> | 需要禁用的 markdown 语法规则 | `[]`
|
|
59
|
+
| `html` | Boolean | 是否允许渲染 HTML | `false`
|
|
60
|
+
|===
|
|
61
|
+
|
|
62
|
+
== Development
|
|
63
|
+
|
|
64
|
+
[source,bash]
|
|
65
|
+
----
|
|
66
|
+
# restore
|
|
67
|
+
yarn install
|
|
68
|
+
# restore peer dependencies
|
|
69
|
+
yarn add highlight.js
|
|
70
|
+
|
|
71
|
+
# build
|
|
72
|
+
./build.sh
|
|
73
|
+
|
|
74
|
+
# test
|
|
75
|
+
yarn test
|
|
76
|
+
|
|
77
|
+
# publish
|
|
78
|
+
export NPM_TOKEN="YOUR-TOKEN-HERE"
|
|
79
|
+
./publish.sh
|
|
80
|
+
----
|
package/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cnblogs/markdown-it-presets",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Markdown-it configuration for cnblogs.com",
|
|
5
|
+
"repository": "git@github.com:cnblogs/packages.git",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"require": "./dist/commonjs/index.cjs",
|
|
11
|
+
"default": "./dist/es6/index.mjs"
|
|
12
|
+
},
|
|
13
|
+
"./math": {
|
|
14
|
+
"types": "./dist/types/math/index.d.ts",
|
|
15
|
+
"require": "./dist/commonjs/math/index.cjs",
|
|
16
|
+
"default": "./dist/es6/math/index.mjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"types": "./dist/types/index.d.ts",
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "shx rm -rf ./dist/** && npm run build:umd && npm run build:commonjs && npm run build:es6 && shx cp -r ./src/presets/styles ./dist && npm run build:types",
|
|
23
|
+
"build:umd": "webpack --config webpack.config.mjs && shx mkdir -p ./dist/styles && shx mv ./dist/umd/styles/** ./dist/styles/ && shx rm -rf ./dist/umd/styles",
|
|
24
|
+
"build:es6": "shx rm -rf ./out-tsc/** && tsc -p ./ -m es6 --declaration true --declarationDir ./out-tsc/ --declarationMap false -m es6 --outDir dist/es6 && renamer --find .js --replace .mjs \"dist/es6/**\"",
|
|
25
|
+
"build:commonjs": "tsc -p ./ -m commonjs --declarationMap false -m es6 --outDir dist/commonjs && renamer --find .js --replace .cjs \"dist/commonjs/**\"",
|
|
26
|
+
"build:types": "api-extractor run --local -c api-extractor.json --verbose && api-extractor run --local -c api-extractor-math.json",
|
|
27
|
+
"inspect": "webpack --config webpack.config.js --profile --json > dist/umd/stats.json && webpack-bundle-analyzer dist/umd/stats.json",
|
|
28
|
+
"test": "jest",
|
|
29
|
+
"format": "prettier --write ."
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@cnblogs/load-script-css": "^1.5.1",
|
|
33
|
+
"github-slugger": "^1.3.0",
|
|
34
|
+
"lodash-es": "^4.17.21",
|
|
35
|
+
"markdown-it": "npm:@cnblogs-gitlab/markdown-it@^12.3.2",
|
|
36
|
+
"markdown-it-abbr": "^1.0.4",
|
|
37
|
+
"markdown-it-anchor": "^6.0.1",
|
|
38
|
+
"markdown-it-attrs": "^4.1.6",
|
|
39
|
+
"markdown-it-container": "^3.0.0",
|
|
40
|
+
"markdown-it-deflist": "^2.1.0",
|
|
41
|
+
"markdown-it-emoji": "^2.0.0",
|
|
42
|
+
"markdown-it-footnote": "^3.0.2",
|
|
43
|
+
"markdown-it-for-inline": "^0.1.1",
|
|
44
|
+
"markdown-it-lazy-headers": "^0.1.3",
|
|
45
|
+
"markdown-it-mark": "^3.0.0",
|
|
46
|
+
"markdown-it-sub": "^1.0.0",
|
|
47
|
+
"markdown-it-sup": "^1.0.0",
|
|
48
|
+
"markdown-it-task-lists": "npm:@cnblogs/markdown-it-task-lists@^2.1.4"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@babel/core": "^7.12.9",
|
|
52
|
+
"@babel/preset-env": "^7.12.7",
|
|
53
|
+
"@babel/preset-typescript": "^7.12.7",
|
|
54
|
+
"@cnblogs/prettier-config": "^2.0.3",
|
|
55
|
+
"@microsoft/api-extractor": "^7.34.4",
|
|
56
|
+
"@types/babel__core": "^7.1.12",
|
|
57
|
+
"@types/jest": "^26.0.17",
|
|
58
|
+
"@types/katex": "^0.11.0",
|
|
59
|
+
"@types/lodash-es": "^4.17.6",
|
|
60
|
+
"@types/markdown-it": "^12.2.3",
|
|
61
|
+
"@types/markdown-it-anchor": "^4.0.4",
|
|
62
|
+
"@types/markdown-it-container": "^2.0.3",
|
|
63
|
+
"@types/mathjax2": "npm:@types/mathjax@^0.0.37",
|
|
64
|
+
"babel-loader": "^8.2.2",
|
|
65
|
+
"css-loader": "^6.5.1",
|
|
66
|
+
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
67
|
+
"highlight.js": "^11.5.1",
|
|
68
|
+
"jest": "^26.6.3",
|
|
69
|
+
"less": "^4.1.2",
|
|
70
|
+
"less-loader": "^10.2.0",
|
|
71
|
+
"mathjax-full": "^3.2.2",
|
|
72
|
+
"mini-css-extract-plugin": "^2.5.3",
|
|
73
|
+
"postcss": "^8.4.5",
|
|
74
|
+
"postcss-loader": "^7.0.1",
|
|
75
|
+
"prettier": "^2.5.1",
|
|
76
|
+
"renamer": "^4.0.0",
|
|
77
|
+
"shx": "^0.3.4",
|
|
78
|
+
"ts-jest": "^26.4.4",
|
|
79
|
+
"typescript": "^4.6.4",
|
|
80
|
+
"webpack": "^5.10.0",
|
|
81
|
+
"webpack-bundle-analyzer": "^4.2.0",
|
|
82
|
+
"webpack-cli": "^4.2.0"
|
|
83
|
+
},
|
|
84
|
+
"peerDependencies": {
|
|
85
|
+
"@types/markdown-it": ">= 12.0.0",
|
|
86
|
+
"highlight.js": ">=11.0.0 < 12.0.0"
|
|
87
|
+
},
|
|
88
|
+
"browserslist": [
|
|
89
|
+
"> 0.25%, not dead"
|
|
90
|
+
],
|
|
91
|
+
"publishConfig": {
|
|
92
|
+
"@cnblogs-team:registry": "https://npm.pkg.github.com/",
|
|
93
|
+
"@cnblogs-gitlab:registry": "https://gitlab.cnblogs.com/api/v4/projects/371/packages/npm/",
|
|
94
|
+
"@cnblogs:registry": "https://registry.npmjs.org/"
|
|
95
|
+
},
|
|
96
|
+
"files": [
|
|
97
|
+
"dist/",
|
|
98
|
+
"math/",
|
|
99
|
+
"package.json",
|
|
100
|
+
"README.adoc",
|
|
101
|
+
".gitignore",
|
|
102
|
+
"tslint.json",
|
|
103
|
+
"tsconfig.base.json",
|
|
104
|
+
"tsconfig.json"
|
|
105
|
+
]
|
|
106
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "es2015",
|
|
4
|
+
"declaration": false,
|
|
5
|
+
"removeComments": true,
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"target": "es2015",
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"lib": ["es2020"],
|
|
10
|
+
"outDir": "./dist",
|
|
11
|
+
"baseUrl": "./",
|
|
12
|
+
"incremental": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"strictBindCallApply": true
|
|
15
|
+
},
|
|
16
|
+
"exclude": ["node_modules", "dist"]
|
|
17
|
+
}
|
package/tsconfig.json
ADDED
package/tslint.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"defaultSeverity": "error",
|
|
3
|
+
"extends": ["tslint:recommended"],
|
|
4
|
+
"jsRules": {
|
|
5
|
+
"no-unused-expression": true
|
|
6
|
+
},
|
|
7
|
+
"rules": {
|
|
8
|
+
"quotemark": [true, "single"],
|
|
9
|
+
"member-access": [false],
|
|
10
|
+
"ordered-imports": [false],
|
|
11
|
+
"max-line-length": [true, 150],
|
|
12
|
+
"member-ordering": [false],
|
|
13
|
+
"interface-name": [false],
|
|
14
|
+
"arrow-parens": false,
|
|
15
|
+
"object-literal-sort-keys": false
|
|
16
|
+
},
|
|
17
|
+
"rulesDirectory": []
|
|
18
|
+
}
|