@canopycanopycanopy/b-ber-grammar-footnotes 3.0.8-next.61 → 3.0.8-next.97

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.
@@ -0,0 +1,4 @@
1
+ //#region src/index.d.ts
2
+ declare function markdownItFootnotePlugin(self: any): (tokens: any) => void;
3
+ export = markdownItFootnotePlugin;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";iBAEwB,wBAAA,CAAyB,IAAA,SACxB,MAAM;AAAA"}
package/dist/index.js CHANGED
@@ -1,59 +1,41 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
5
- _Object$defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = markdownItFootnotePlugin;
9
- var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
10
- var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
1
+ let _canopycanopycanopy_b_ber_lib = require("@canopycanopycanopy/b-ber-lib");
2
+ //#region src/index.ts
11
3
  function markdownItFootnotePlugin(self) {
12
- return function plugin(tokens) {
13
- const {
14
- fileName
15
- } = self;
16
- const entry = (0, _find.default)(_State.default).call(_State.default, 'spine.flattened', {
17
- fileName
18
- });
19
- const title = (entry === null || entry === void 0 ? void 0 : entry.title) || fileName;
20
-
21
- // Add footnote container and heading. Doing this here instead of in
22
- // `footnotes.js` because we need the file's title
23
- tokens.unshift({
24
- type: 'block',
25
- tag: 'section',
26
- attrs: [['class', 'footnotes break-after']],
27
- nesting: 1,
28
- block: true
29
- }, {
30
- type: 'block',
31
- tag: 'h1',
32
- nesting: 1,
33
- block: true
34
- }, {
35
- type: 'text',
36
- block: false,
37
- content: title
38
- }, {
39
- type: 'block',
40
- tag: 'h1',
41
- nesting: -1
42
- });
43
-
44
- // add closing section tag
45
- tokens.push({
46
- type: 'block',
47
- tag: 'section',
48
- nesting: -1
49
- });
50
- const notes = self.markdownIt.renderer.render(tokens, 0, {
51
- reference: `${fileName}.xhtml`
52
- });
53
- _State.default.add('footnotes', {
54
- fileName,
55
- title,
56
- notes
57
- });
58
- };
59
- }
4
+ return function plugin(tokens) {
5
+ const { fileName } = self;
6
+ const title = _canopycanopycanopy_b_ber_lib.State.find("spine.flattened", { fileName })?.title || fileName;
7
+ tokens.unshift({
8
+ type: "block",
9
+ tag: "section",
10
+ attrs: [["class", "footnotes break-after"]],
11
+ nesting: 1,
12
+ block: true
13
+ }, {
14
+ type: "block",
15
+ tag: "h1",
16
+ nesting: 1,
17
+ block: true
18
+ }, {
19
+ type: "text",
20
+ block: false,
21
+ content: title
22
+ }, {
23
+ type: "block",
24
+ tag: "h1",
25
+ nesting: -1
26
+ });
27
+ tokens.push({
28
+ type: "block",
29
+ tag: "section",
30
+ nesting: -1
31
+ });
32
+ const notes = self.markdownIt.renderer.render(tokens, 0, { reference: `${fileName}.xhtml` });
33
+ _canopycanopycanopy_b_ber_lib.State.add("footnotes", {
34
+ fileName,
35
+ title,
36
+ notes
37
+ });
38
+ };
39
+ }
40
+ //#endregion
41
+ module.exports = markdownItFootnotePlugin;
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "@canopycanopycanopy/b-ber-grammar-footnotes",
3
- "version": "3.0.8-next.61+2bbec564",
3
+ "version": "3.0.8-next.97+2e9748e6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "prepare:dist": "BABEL_ENV=production babel --config-file ../../babel.config.js -d dist/ src/ --ignore **/__tests__/**",
8
- "clean": "rimraf dist",
9
- "prepare": "npm run clean && npm run prepare:dist",
10
- "build": "npm run prepare",
11
- "watch": "BABEL_ENV=production babel --config-file ../../babel.config.js -d dist/ src/ --watch src",
7
+ "build": "tsdown",
8
+ "typecheck": "tsc --noEmit",
12
9
  "test": "jest"
13
10
  },
14
11
  "author": "Triple Canopy <b-ber@canopycanopycanopy.com> (https://triplecanopy.github.io/)",
@@ -17,15 +14,15 @@
17
14
  "access": "public"
18
15
  },
19
16
  "devDependencies": {
20
- "@babel/cli": "^7.10.5",
21
- "@babel/core": "^7.10.5",
22
- "@babel/preset-env": "^7.10.4",
23
- "browserslist": "^4.17.4",
24
- "jest": "^26.6.3",
25
- "rimraf": "^2.7.1"
17
+ "@swc/core": "^1.15.40",
18
+ "@swc/jest": "^0.2.39",
19
+ "jest": "^29.7.0",
20
+ "rimraf": "^2.7.1",
21
+ "tsdown": "^0.22.1",
22
+ "typescript": "^6.0.3"
26
23
  },
27
24
  "dependencies": {
28
- "@canopycanopycanopy/b-ber-lib": "3.0.8-next.61+2bbec564",
25
+ "@canopycanopycanopy/b-ber-lib": "3.0.8-next.97+2e9748e6",
29
26
  "lodash": "^4.17.21",
30
27
  "lodash.find": "latest",
31
28
  "tar": "^6.1.11"
@@ -47,5 +44,6 @@
47
44
  "url": "https://maxwellsimmer.com"
48
45
  }
49
46
  ],
50
- "gitHead": "2bbec5643278f53becb0d2ba1f55edfe379d5587"
47
+ "gitHead": "2e9748e6f00446cd35dc8f933e049d8200fc24dd",
48
+ "types": "dist/index.d.ts"
51
49
  }