@adobe/helix-html-pipeline 1.5.5 → 1.5.8
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 +21 -0
- package/package.json +2 -2
- package/src/PipelineContent.d.ts +2 -2
- package/src/PipelineContent.js +2 -2
- package/src/forms-pipe.js +4 -2
- package/src/utils/id-slugger.js +38 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [1.5.8](https://github.com/adobe/helix-html-pipeline/compare/v1.5.7...v1.5.8) (2022-05-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* forms service expect repo and owner in message body ([a14e6a0](https://github.com/adobe/helix-html-pipeline/commit/a14e6a0800704a49173ae62ca95dfcbc2cdd3638))
|
|
7
|
+
|
|
8
|
+
## [1.5.7](https://github.com/adobe/helix-html-pipeline/compare/v1.5.6...v1.5.7) (2022-05-17)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/helix-markdown-support to v3.1.5 ([10b3bb9](https://github.com/adobe/helix-html-pipeline/commit/10b3bb9175685b0367d1e834054974bc4da25b6e))
|
|
14
|
+
|
|
15
|
+
## [1.5.6](https://github.com/adobe/helix-html-pipeline/compare/v1.5.5...v1.5.6) (2022-05-17)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* avoid leading digits in heading ids ([#60](https://github.com/adobe/helix-html-pipeline/issues/60)) ([b2af7bf](https://github.com/adobe/helix-html-pipeline/commit/b2af7bf23f8479ba31c410d5b0a3316bbe071481)), closes [#59](https://github.com/adobe/helix-html-pipeline/issues/59)
|
|
21
|
+
|
|
1
22
|
## [1.5.5](https://github.com/adobe/helix-html-pipeline/compare/v1.5.4...v1.5.5) (2022-05-16)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"loader": "esmock"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@adobe/helix-markdown-support": "3.1.
|
|
33
|
+
"@adobe/helix-markdown-support": "3.1.5",
|
|
34
34
|
"@adobe/helix-shared-utils": "2.0.10",
|
|
35
35
|
"github-slugger": "1.4.0",
|
|
36
36
|
"hast-util-raw": "7.2.1",
|
package/src/PipelineContent.d.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
import {Node} from "unist";
|
|
13
|
-
import GithubSlugger from 'github-slugger';
|
|
14
13
|
import { Root } from 'hast';
|
|
14
|
+
import { IDSlugger } from './utils/id-slugger.js';
|
|
15
15
|
|
|
16
16
|
declare enum SourceType {
|
|
17
17
|
CONTENT = 'content',
|
|
@@ -58,7 +58,7 @@ declare class PipelineContent {
|
|
|
58
58
|
/**
|
|
59
59
|
* slugger to use for heading id calculations
|
|
60
60
|
*/
|
|
61
|
-
slugger:
|
|
61
|
+
slugger: IDSlugger;
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* document specific metadata
|
package/src/PipelineContent.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
import
|
|
12
|
+
import { IDSlugger } from './utils/id-slugger.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* State of the pipeline
|
|
@@ -22,7 +22,7 @@ export class PipelineContent {
|
|
|
22
22
|
constructor() {
|
|
23
23
|
Object.assign(this, {
|
|
24
24
|
sourceBus: 'content',
|
|
25
|
-
slugger: new
|
|
25
|
+
slugger: new IDSlugger(),
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
}
|
package/src/forms-pipe.js
CHANGED
|
@@ -140,10 +140,12 @@ export async function formsPipe(state, request) {
|
|
|
140
140
|
// sheet and the source location is not null
|
|
141
141
|
const host = getOriginalHost(request.headers);
|
|
142
142
|
|
|
143
|
+
// Forms service expect owner and repo in the message body
|
|
144
|
+
body.owner = owner;
|
|
145
|
+
body.repo = repo;
|
|
146
|
+
|
|
143
147
|
const message = {
|
|
144
148
|
url: `https://${ref}--${repo}--${owner}.hlx.live${resourcePath}`,
|
|
145
|
-
owner,
|
|
146
|
-
repo,
|
|
147
149
|
body,
|
|
148
150
|
host,
|
|
149
151
|
sourceLocation,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import GithubSlugger from 'github-slugger';
|
|
13
|
+
|
|
14
|
+
export class IDSlugger {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.occurrences = {};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generate a unique slug.
|
|
21
|
+
* @param {string} value String of text to slugify
|
|
22
|
+
* @return {string} A unique slug string
|
|
23
|
+
*/
|
|
24
|
+
slug(value) {
|
|
25
|
+
let id = GithubSlugger.slug(value)
|
|
26
|
+
// remove leading numbers
|
|
27
|
+
.replace(/^\d+-+/, '');
|
|
28
|
+
|
|
29
|
+
// resolve collisions
|
|
30
|
+
const original = id;
|
|
31
|
+
while (id in this.occurrences) {
|
|
32
|
+
this.occurrences[original] += 1;
|
|
33
|
+
id = `${original}-${this.occurrences[original]}`;
|
|
34
|
+
}
|
|
35
|
+
this.occurrences[id] = 0;
|
|
36
|
+
return id;
|
|
37
|
+
}
|
|
38
|
+
}
|