Skip to content
This repository was archived by the owner on Feb 28, 2022. It is now read-only.

Commit 69223a4

Browse files
authored
feat(pipe): Remove image responsifier (#381)
fixes #380
1 parent 92cc39c commit 69223a4

15 files changed

+14
-371
lines changed

docs/secrets.schema.json

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/secrets.schema.md

Lines changed: 0 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/action.d.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,17 @@ export interface Secrets {
132132
* Timeout for outgoing HTTP requests in milliseconds
133133
*/
134134
HTTP_TIMEOUT?: number;
135-
/**
136-
* Maximum physical with of responsive images to generate
137-
*/
138-
IMAGES_MAX_SIZE?: number;
139-
/**
140-
* Number of intermediary size steps to create per image
141-
*/
142-
IMAGES_SIZE_STEPS?: number;
143-
/**
144-
* Value for the `sizes` attribute of generated responsive images
145-
*/
146-
IMAGES_SIZES?: string;
147135
TEST_BOOLEAN?: boolean;
148136
/**
149137
* Print XML with line breaks and indentation
150138
*/
151139
XML_PRETTY?: boolean;
140+
/**
141+
* Sanitize the HTML output to guard against XSS attacks.
142+
*
143+
* **Note:** this flag applies a pretty aggressive DOM filtering that will strip out a lot of HTML that your authors might find useful. The setting is meant for processing truly untrusted inputs, such as comments in a social media site.
144+
*/
145+
SANITIZE_DOM?: boolean;
152146
/**
153147
* This interface was referenced by `Secrets`'s JSON-Schema definition
154148
* via the `patternProperty` "[A-Z0-9_]+".

src/defaults/html.pipe.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const fetch = require('../html/fetch-markdown.js');
1616
const parse = require('../html/parse-markdown.js');
1717
const meta = require('../html/get-metadata.js');
1818
const html = require('../html/make-html.js');
19-
// const responsive = require('../html/responsify-images.js');
2019
const type = require('../utils/set-content-type.js');
2120
const selectStatus = require('../html/set-status.js');
2221
const smartypants = require('../html/smartypants');
@@ -69,9 +68,6 @@ const htmlpipe = (cont, context, action) => {
6968
.before(selectstrain)
7069
.before(selecttest)
7170
.before(html).expose('html')
72-
// todo: responsive used to operate on the htast, therefore ignored if content.document was used
73-
// todo: there is similar logic in the image-handler during jsdom creation....
74-
// .before(responsive)
7571
.before(sanitize).when(paranoid)
7672
.once(cont)
7773
.after(type('text/html'))

src/html/responsify-images.js

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/schemas/secrets.schema.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,6 @@
6060
"description": "Timeout for outgoing HTTP requests in milliseconds",
6161
"default": 1000
6262
},
63-
"IMAGES_MAX_SIZE": {
64-
"type": "integer",
65-
"description": "Maximum physical with of responsive images to generate",
66-
"default": 4096
67-
},
68-
"IMAGES_SIZE_STEPS": {
69-
"type": "integer",
70-
"description": "Number of intermediary size steps to create per image",
71-
"default": 4
72-
},
73-
"IMAGES_SIZES": {
74-
"type": "string",
75-
"description": "Value for the `sizes` attribute of generated responsive images",
76-
"default": "100vw"
77-
},
7863
"TEST_BOOLEAN": {
7964
"type":"boolean",
8065
"default": true

src/utils/image-handler.js

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/utils/mdast-to-vdom.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const mdast2hast = require('mdast-util-to-hast');
1717
const { JSDOM } = require('jsdom');
1818
const toDOM = require('./hast-util-to-dom');
1919
const HeadingHandler = require('./heading-handler');
20-
const image = require('./image-handler');
2120
const embed = require('./embed-handler');
2221
const link = require('./link-handler');
2322
const types = require('../schemas/mdast.schema.json').properties.type.enum;
@@ -39,10 +38,6 @@ class VDOMTransformer {
3938
* Initializes the transformer with a Markdown document or fragment of a document
4039
* @param {Node} mdast the markdown AST node to start the transformation from.
4140
* @param {object} options options for custom transformers
42-
* @param {string[]} options.IMAGES_SIZES a list of size media queries
43-
* @param {number} options.IMAGES_MIN_SIZE from smallest possible size
44-
* @param {number} options.IMAGES_MAX_SIZE to largest possible size
45-
* @param {number} options.IMAGES_SIZE_STEPS steps number of steps
4641
*/
4742
constructor(mdast, options) {
4843
this._matchers = [];
@@ -59,7 +54,6 @@ class VDOMTransformer {
5954

6055
this._headingHandler = new HeadingHandler(options);
6156
this.match('heading', this._headingHandler.handler());
62-
this.match('image', image(options));
6357
this.match('embed', embed(options));
6458
this.match('link', link(options));
6559
this.match('html', (h, node) => {

test/testCoercer.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ describe('Test Coercing Secrets', () => {
3535
assert.equal(action.secrets.REPO_RAW_ROOT, 'https://raw.githubusercontent.com/');
3636
});
3737

38-
it('Defaults have correct types (number)', async () => {
39-
const action = { logger };
40-
await coerce(action);
41-
assert.ok(action.secrets.IMAGES_MAX_SIZE);
42-
assert.equal(action.secrets.IMAGES_MAX_SIZE, 4096);
43-
assert.equal(typeof action.secrets.IMAGES_MAX_SIZE, 'number');
44-
});
45-
4638
it('Defaults have correct types (boolean)', async () => {
4739
const action = { logger };
4840
await coerce(action);
@@ -55,11 +47,4 @@ describe('Test Coercing Secrets', () => {
5547
assert.equal(action.secrets.TEST_BOOLEAN, false);
5648
assert.equal(typeof action.secrets.TEST_BOOLEAN, 'boolean');
5749
});
58-
59-
it('Secrets have correct types (number)', async () => {
60-
const action = { logger, secrets: { IMAGES_MAX_SIZE: '4000' } };
61-
await coerce(action);
62-
assert.equal(action.secrets.IMAGES_MAX_SIZE, 4000);
63-
assert.equal(typeof action.secrets.IMAGES_MAX_SIZE, 'number');
64-
});
6550
});

0 commit comments

Comments
 (0)