crossnote 0.8.0 → 0.8.2
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/LICENSE.md +2 -2
- package/README.md +41 -45
- package/out/cjs/index.cjs +73 -63
- package/out/esm/index.mjs +86 -76
- package/out/types/src/notebook/types.d.ts +12 -5
- package/out/types/src/utility.d.ts +1 -0
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/out/webview/index.js +1 -1
- package/package.json +1 -1
package/LICENSE.md
CHANGED
|
@@ -2,11 +2,11 @@ University of Illinois/NCSA
|
|
|
2
2
|
Open Source License
|
|
3
3
|
|
|
4
4
|
```
|
|
5
|
-
Copyright (c) 2017 Yiyi Wang
|
|
5
|
+
Copyright (c) 2017 ~ 2023 Yiyi Wang
|
|
6
6
|
All rights reserved.
|
|
7
7
|
|
|
8
8
|
Developed by: Yiyi Wang
|
|
9
|
-
https://github.com/shd101wyy/
|
|
9
|
+
https://github.com/shd101wyy/crossnote
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
package/README.md
CHANGED
|
@@ -1,51 +1,49 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Crossnote `[WIP]`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Also called as `mume` before.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/crossnote)
|
|
6
|
+
[](https://www.npmjs.com/package/crossnote)
|
|
7
|
+
[](https://www.npmjs.com/package/crossnote)
|
|
4
8
|
|
|
5
9
|
This library powers:
|
|
6
10
|
|
|
7
|
-
- [markdown preview enhanced for atom](https://github.com/shd101wyy/markdown-preview-enhanced)
|
|
8
11
|
- [markdown preview enhanced for vscode](https://github.com/shd101wyy/vscode-markdown-preview-enhanced)
|
|
9
12
|
|
|
10
|
-
and other external projects such as:
|
|
11
|
-
|
|
12
|
-
- [TechnicalMarkdown](https://github.com/gabyx/TechnicalMarkdown) up to commit 13856d37030483679
|
|
13
|
-
|
|
14
13
|
## Installation
|
|
15
14
|
|
|
16
15
|
```sh
|
|
17
|
-
|
|
16
|
+
# If you are using npm
|
|
17
|
+
$ npm install --save crossnote
|
|
18
|
+
|
|
19
|
+
# If you are using yarn
|
|
20
|
+
$ yarn add crossnote
|
|
18
21
|
```
|
|
19
22
|
|
|
20
23
|
## Example
|
|
21
24
|
|
|
22
25
|
```javascript
|
|
23
26
|
// CJS
|
|
24
|
-
const
|
|
25
|
-
const mume = require('@shd101wyy/mume');
|
|
27
|
+
const { Notebook } = require('crossnote');
|
|
26
28
|
|
|
27
29
|
// ESM
|
|
28
|
-
// import
|
|
30
|
+
// import { Notebook } from "crossnote"
|
|
29
31
|
|
|
30
32
|
async function main() {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
// if no configPath is specified, the default is "~/.config/mume"
|
|
34
|
-
// but only if the old location (~/.mume) does not exist
|
|
35
|
-
await mume.init(configPath);
|
|
36
|
-
|
|
37
|
-
const engine = new mume.MarkdownEngine({
|
|
38
|
-
filePath: '/Users/wangyiyi/Desktop/markdown-example/test3.md',
|
|
33
|
+
const notebook = await Notebook.init({
|
|
34
|
+
notebookPath: '/absolute/path/to/your/notebook',
|
|
39
35
|
config: {
|
|
40
|
-
configPath: configPath,
|
|
41
36
|
previewTheme: 'github-light.css',
|
|
42
|
-
|
|
43
|
-
codeBlockTheme: '
|
|
37
|
+
mathRenderingOption: 'KaTeX',
|
|
38
|
+
codeBlockTheme: 'github.css',
|
|
44
39
|
printBackground: true,
|
|
45
|
-
enableScriptExecution: true, // <=
|
|
40
|
+
enableScriptExecution: true, // <= For running code chunks.
|
|
46
41
|
},
|
|
47
42
|
});
|
|
48
43
|
|
|
44
|
+
// Get the markdown engine for a specific note file in your notebook.
|
|
45
|
+
const engine = notebook.getNoteMarkdownEngine('README.md');
|
|
46
|
+
|
|
49
47
|
// open in browser
|
|
50
48
|
await engine.openInBrowser({ runAllCodeChunks: true });
|
|
51
49
|
|
|
@@ -73,13 +71,10 @@ async function main() {
|
|
|
73
71
|
main();
|
|
74
72
|
```
|
|
75
73
|
|
|
76
|
-
##
|
|
74
|
+
## Notebook Configuration
|
|
77
75
|
|
|
78
76
|
```js
|
|
79
77
|
const config = {
|
|
80
|
-
// Default config directory; `null` means "~/.config/mume"
|
|
81
|
-
configPath : null,
|
|
82
|
-
|
|
83
78
|
// Enable this option will render markdown by pandoc instead of markdown-it.
|
|
84
79
|
usePandocParser: false,
|
|
85
80
|
|
|
@@ -104,8 +99,6 @@ const config = {
|
|
|
104
99
|
// If checked, we use GitHub style piped wiki links, i.e. [[linkText|wikiLink]]. Otherwise, we use
|
|
105
100
|
// [[wikiLink|linkText]] as the original Wikipedia style.
|
|
106
101
|
useGitHubStylePipedLink: true
|
|
107
|
-
// By default, the extension for wikilink is `.md`. For example: [[test]] will direct to file path `test.md`.
|
|
108
|
-
wikiLinkFileExtension: '.md'
|
|
109
102
|
|
|
110
103
|
// Enable emoji & font-awesome plugin. This only works for markdown-it parser, but not pandoc parser.
|
|
111
104
|
enableEmojiSyntax: true
|
|
@@ -261,29 +254,32 @@ const config = {
|
|
|
261
254
|
// Kroki server url.
|
|
262
255
|
krokiServer: "https://kroki.io",
|
|
263
256
|
}
|
|
264
|
-
|
|
265
|
-
// Init Engine
|
|
266
|
-
const engine = new mume.MarkdownEngine({
|
|
267
|
-
filePath: '...',
|
|
268
|
-
projectDirectoryPath: '...',
|
|
269
|
-
config: config
|
|
270
|
-
})
|
|
271
257
|
```
|
|
272
258
|
|
|
273
|
-
##
|
|
259
|
+
## Notebook Local Configuration
|
|
274
260
|
|
|
275
|
-
|
|
261
|
+
If your notebook has `.crossnote` directory, then when you run `await Notebook.init`, it will automatically create several configuration files in `.crossnote` directory and load the configurations.
|
|
276
262
|
|
|
277
|
-
|
|
263
|
+
```
|
|
264
|
+
.crossnote
|
|
265
|
+
├── katex.json
|
|
266
|
+
├── mathjax_v3.json
|
|
267
|
+
├── mermaid.json
|
|
268
|
+
├── parser.mjs
|
|
269
|
+
└── style.less
|
|
270
|
+
```
|
|
278
271
|
|
|
279
|
-
|
|
280
|
-
Recommended to use Node.js version 20.
|
|
272
|
+
## Development
|
|
281
273
|
|
|
282
|
-
1. Clone this project
|
|
283
|
-
2. Run `yarn` from shell
|
|
284
|
-
3.
|
|
285
|
-
4. Run
|
|
274
|
+
1. Clone this project.
|
|
275
|
+
2. Run `yarn install` from shell.
|
|
276
|
+
3. Run `yarn build:watch` to start the watch mode.
|
|
277
|
+
4. Run `yarn build` to build the project.
|
|
286
278
|
|
|
287
279
|
Or
|
|
288
280
|
|
|
289
281
|
If you already have [nix](https://nixos.org/download.html) and [direnv](https://direnv.net/) installed, simply cd to the project directory, then run `direnv allow` once.
|
|
282
|
+
|
|
283
|
+
## License
|
|
284
|
+
|
|
285
|
+
[University of Illinois/NCSA Open Source License](LICENSE.md)
|