@se-studio/markdown-renderer 1.0.39 → 1.0.41
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/CHANGELOG.md +18 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/resolveMarkdownParams.d.ts +20 -0
- package/dist/resolveMarkdownParams.d.ts.map +1 -0
- package/dist/resolveMarkdownParams.js +53 -0
- package/dist/resolveMarkdownParams.js.map +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @se-studio/markdown-renderer
|
|
2
2
|
|
|
3
|
+
## 1.0.41
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Bulk version bump: patch for all packages
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @se-studio/contentful-rest-api@1.0.77
|
|
10
|
+
- @se-studio/core-data-types@1.0.77
|
|
11
|
+
|
|
12
|
+
## 1.0.40
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Bulk version bump: patch for all packages
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @se-studio/contentful-rest-api@1.0.76
|
|
19
|
+
- @se-studio/core-data-types@1.0.76
|
|
20
|
+
|
|
3
21
|
## 1.0.39
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface MarkdownRouteOptions {
|
|
2
|
+
articlesSlug: string;
|
|
3
|
+
tagsSlug: string;
|
|
4
|
+
peopleSlug: string;
|
|
5
|
+
articlesBaseIsPage: boolean;
|
|
6
|
+
enablePrimaryTagPartOfSlug: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type ResolveMarkdownParamsResult = {
|
|
9
|
+
ok: true;
|
|
10
|
+
type: 'page' | 'article' | 'customType' | 'person';
|
|
11
|
+
slug: string;
|
|
12
|
+
articleType?: string;
|
|
13
|
+
customType?: string;
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
status: 404;
|
|
17
|
+
body: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function resolveMarkdownParams(slugParams: string[], options: MarkdownRouteOptions): ResolveMarkdownParamsResult;
|
|
20
|
+
//# sourceMappingURL=resolveMarkdownParams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveMarkdownParams.d.ts","sourceRoot":"","sources":["../src/resolveMarkdownParams.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,0BAA0B,EAAE,OAAO,CAAC;CACrC;AAED,MAAM,MAAM,2BAA2B,GACnC;IACE,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAK7C,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAAE,EACpB,OAAO,EAAE,oBAAoB,GAC5B,2BAA2B,CAoD7B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const LISTING_NOT_SUPPORTED = 'Listing pages not supported for markdown export';
|
|
2
|
+
const TEAM_INDEX_NOT_SUPPORTED = 'Team index page not supported for markdown export';
|
|
3
|
+
export function resolveMarkdownParams(slugParams, options) {
|
|
4
|
+
const path = slugParams.join('/');
|
|
5
|
+
const first = slugParams[0];
|
|
6
|
+
if (first === options.tagsSlug) {
|
|
7
|
+
return { ok: false, status: 404, body: LISTING_NOT_SUPPORTED };
|
|
8
|
+
}
|
|
9
|
+
if (first === options.articlesSlug) {
|
|
10
|
+
if (slugParams.length === 1 && options.articlesBaseIsPage) {
|
|
11
|
+
return {
|
|
12
|
+
ok: true,
|
|
13
|
+
type: 'page',
|
|
14
|
+
slug: options.articlesSlug,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (options.enablePrimaryTagPartOfSlug) {
|
|
18
|
+
if (slugParams.length < 4) {
|
|
19
|
+
return { ok: false, status: 404, body: LISTING_NOT_SUPPORTED };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else if (slugParams.length < 3) {
|
|
23
|
+
return { ok: false, status: 404, body: LISTING_NOT_SUPPORTED };
|
|
24
|
+
}
|
|
25
|
+
const articleType = slugParams[1];
|
|
26
|
+
const slug = options.enablePrimaryTagPartOfSlug
|
|
27
|
+
? slugParams.slice(3).join('/')
|
|
28
|
+
: slugParams.slice(2).join('/');
|
|
29
|
+
return {
|
|
30
|
+
ok: true,
|
|
31
|
+
type: 'article',
|
|
32
|
+
slug,
|
|
33
|
+
articleType,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (first === options.peopleSlug) {
|
|
37
|
+
if (slugParams.length < 2) {
|
|
38
|
+
return { ok: false, status: 404, body: TEAM_INDEX_NOT_SUPPORTED };
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
ok: true,
|
|
42
|
+
type: 'person',
|
|
43
|
+
slug: slugParams[1],
|
|
44
|
+
customType: options.peopleSlug,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
ok: true,
|
|
49
|
+
type: 'page',
|
|
50
|
+
slug: path,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=resolveMarkdownParams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveMarkdownParams.js","sourceRoot":"","sources":["../src/resolveMarkdownParams.ts"],"names":[],"mappings":"AAkBA,MAAM,qBAAqB,GAAG,iDAAiD,CAAC;AAChF,MAAM,wBAAwB,GAAG,mDAAmD,CAAC;AAErF,MAAM,UAAU,qBAAqB,CACnC,UAAoB,EACpB,OAA6B;IAE7B,MAAM,I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R,IAAI,EAAE,SAAS;YACf,IAAI;YACJ,WAAW;SACZ,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,KAAK,OAAO,CAAC,UAAU,EAAE,CAAC;QACjC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;QACpE,CAAC;QACD,OAAO;YACL,EAAE,EAAE,IAAI;YACR,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,UAAU,CAAC,CAAC,CAAW;YAC7B,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,IAAI;KACX,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/markdown-renderer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.41",
|
|
4
4
|
"description": "Markdown renderer for Contentful content",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@contentful/rich-text-types": "^17.2.5",
|
|
26
26
|
"html-entities": "^2.6.0",
|
|
27
27
|
"js-yaml": "^4.1.1",
|
|
28
|
-
"@se-studio/contentful-rest-api": "1.0.
|
|
29
|
-
"@se-studio/core-data-types": "1.0.
|
|
28
|
+
"@se-studio/contentful-rest-api": "1.0.77",
|
|
29
|
+
"@se-studio/core-data-types": "1.0.77"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@biomejs/biome": "^2.3.15",
|