@difizen/libro-markdown 0.1.1 → 0.1.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/es/anchor.d.ts +1 -1
- package/es/anchor.d.ts.map +1 -1
- package/es/anchor.js +8 -8
- package/package.json +1 -1
- package/src/anchor.ts +1 -1
- package/src/index.spec.ts +3 -3
package/es/anchor.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface PermalinkOptions {
|
|
|
13
13
|
ariaHidden: boolean;
|
|
14
14
|
}
|
|
15
15
|
export declare function renderHref(slug: string): string;
|
|
16
|
-
export declare function renderAttrs(
|
|
16
|
+
export declare function renderAttrs(slug: string): {};
|
|
17
17
|
declare const position: {
|
|
18
18
|
readonly false: "push";
|
|
19
19
|
readonly true: "unshift";
|
package/es/anchor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../src/anchor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,0CAA0C,CAAC;AAClE,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG,CACxB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,KAAK,KACT,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,OAAO,QAAQ,CAAC;IACjC,U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,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACvC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC;IACzB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC7C;AAED,eAAO,MAAM,OAAO,MAAO,MAAM,WACwC,CAAC;AAiD1E;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,OAAO,CAAC,aAAa,CAAC,CAoDjE,CAAC"}
|
package/es/anchor.js
CHANGED
|
@@ -15,7 +15,7 @@ export function renderHref(slug) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18
|
-
export function renderAttrs(
|
|
18
|
+
export function renderAttrs(slug) {
|
|
19
19
|
return {};
|
|
20
20
|
}
|
|
21
21
|
var commonDefaults = {
|
|
@@ -127,22 +127,22 @@ export var libroAnchor = function libroAnchor(md, options) {
|
|
|
127
127
|
|
|
128
128
|
// Aggregate the next token children text.
|
|
129
129
|
var title = opts.getTokensText((_tokens$children = tokens[idx + 1].children) !== null && _tokens$children !== void 0 ? _tokens$children : []);
|
|
130
|
-
var
|
|
131
|
-
if (
|
|
132
|
-
|
|
130
|
+
var _slug = token.attrGet('id');
|
|
131
|
+
if (_slug === null) {
|
|
132
|
+
_slug = uniqueSlug(opts.slugify(title), slugs, false, opts.uniqueSlugStartIndex);
|
|
133
133
|
} else {
|
|
134
|
-
|
|
134
|
+
_slug = uniqueSlug(_slug, slugs, true, opts.uniqueSlugStartIndex);
|
|
135
135
|
}
|
|
136
136
|
if (cellId) {
|
|
137
|
-
token.attrSet('id', "".concat(cellId, "-").concat(
|
|
137
|
+
token.attrSet('id', "".concat(cellId, "-").concat(_slug));
|
|
138
138
|
} else {
|
|
139
|
-
token.attrSet('id',
|
|
139
|
+
token.attrSet('id', _slug);
|
|
140
140
|
}
|
|
141
141
|
if (opts.tabIndex !== false) {
|
|
142
142
|
token.attrSet('tabindex', "".concat(opts.tabIndex));
|
|
143
143
|
}
|
|
144
144
|
if (typeof opts.permalink === 'function') {
|
|
145
|
-
opts.permalink(
|
|
145
|
+
opts.permalink(_slug, opts.permalinkOptions, state, idx);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
// A permalink renderer could modify the `tokens` array so
|
package/package.json
CHANGED
package/src/anchor.ts
CHANGED
package/src/index.spec.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
1
2
|
import assert from 'assert';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
import 'reflect-metadata';
|
|
4
|
+
import { MarkdownModule } from './index.js';
|
|
5
5
|
|
|
6
6
|
describe('libro-markdown', () => {
|
|
7
7
|
it('#import', () => {
|
|
8
|
-
assert(
|
|
8
|
+
assert(MarkdownModule);
|
|
9
9
|
});
|
|
10
10
|
});
|