@tryghost/mg-medium-export 0.27.7 → 0.28.0-0
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/README.md +83 -10
- package/build/index.d.ts +7 -0
- package/build/index.js +6 -0
- package/build/index.js.map +1 -0
- package/build/lib/ingest.d.ts +22 -0
- package/build/lib/ingest.js +66 -0
- package/build/lib/ingest.js.map +1 -0
- package/build/lib/map.d.ts +23 -0
- package/build/lib/map.js +245 -0
- package/build/lib/map.js.map +1 -0
- package/build/lib/process-content.d.ts +21 -0
- package/{lib → build/lib}/process-content.js +14 -47
- package/build/lib/process-content.js.map +1 -0
- package/build/lib/process-post.d.ts +17 -0
- package/build/lib/process-post.js +176 -0
- package/build/lib/process-post.js.map +1 -0
- package/build/lib/process-profile.d.ts +6 -0
- package/{lib → build/lib}/process-profile.js +10 -14
- package/build/lib/process-profile.js.map +1 -0
- package/build/lib/types.d.ts +58 -0
- package/build/lib/types.js +3 -0
- package/build/lib/types.js.map +1 -0
- package/build/test/helpers.d.ts +39 -0
- package/build/test/helpers.js +78 -0
- package/build/test/helpers.js.map +1 -0
- package/build/test/ingest.test.d.ts +1 -0
- package/build/test/ingest.test.js +115 -0
- package/build/test/ingest.test.js.map +1 -0
- package/build/test/map.test.d.ts +1 -0
- package/build/test/map.test.js +286 -0
- package/build/test/map.test.js.map +1 -0
- package/build/test/process-profile.test.d.ts +1 -0
- package/build/test/process-profile.test.js +70 -0
- package/build/test/process-profile.test.js.map +1 -0
- package/build/test/process.test.d.ts +1 -0
- package/build/test/process.test.js +505 -0
- package/build/test/process.test.js.map +1 -0
- package/package.json +22 -12
- package/index.js +0 -11
- package/lib/process-post.js +0 -182
- package/lib/process.js +0 -24
- package/lib/read-zip.js +0 -83
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { describe, it } from 'node:test';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { RecordDataError } from '@tryghost/mg-context';
|
|
7
|
+
import { domUtils } from '@tryghost/mg-utils';
|
|
8
|
+
import { mediumHandle, postUrl, processContent, processPost as convertPost } from '../index.js';
|
|
9
|
+
const fixtures = fileURLToPath(new URL('../../src/test/fixtures/export/posts/', import.meta.url));
|
|
10
|
+
const DATE = new Date('2024-02-03T04:05:06.000Z');
|
|
11
|
+
const readSync = (name) => {
|
|
12
|
+
return readFileSync(join(fixtures, name), { encoding: 'utf8' });
|
|
13
|
+
};
|
|
14
|
+
const processPost = ({ name, html, options }) => convertPost({ name, html, options, date: DATE });
|
|
15
|
+
const extractEContent = (html) => {
|
|
16
|
+
const parsed = domUtils.parseFragment(html);
|
|
17
|
+
const eContent = parsed.$('.e-content')[0];
|
|
18
|
+
return eContent ? domUtils.serializeChildren(eContent) : '';
|
|
19
|
+
};
|
|
20
|
+
const assertMediumMetaObject = (value) => {
|
|
21
|
+
assert.equal(typeof value, 'object');
|
|
22
|
+
assert.ok(value !== null);
|
|
23
|
+
assert.ok('url' in value);
|
|
24
|
+
assert.ok('data' in value);
|
|
25
|
+
assert.equal(typeof value.url, 'string');
|
|
26
|
+
assert.match(value.url, /^https:\/\/medium\.com/);
|
|
27
|
+
assert.equal(typeof value.data, 'object');
|
|
28
|
+
assert.ok(value.data !== null);
|
|
29
|
+
assert.ok('slug' in value.data);
|
|
30
|
+
};
|
|
31
|
+
describe('Process', function () {
|
|
32
|
+
it('Can process a basic medium post', function () {
|
|
33
|
+
const fixture = readSync('basic-post.html');
|
|
34
|
+
const fakeName = '2018-08-11_blog-post-title-efefef121212.html';
|
|
35
|
+
const post = processPost({
|
|
36
|
+
name: fakeName,
|
|
37
|
+
html: fixture,
|
|
38
|
+
options: {
|
|
39
|
+
addPlatformTag: true
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
assertMediumMetaObject(post);
|
|
43
|
+
assert.equal(post.url, 'https://medium.com/@JoeBloggs/testpost-efefef12121212');
|
|
44
|
+
assert.equal(post.data.title, 'Basic Post Title');
|
|
45
|
+
assert.equal(post.data.slug, 'testpost');
|
|
46
|
+
assert.equal(post.data.custom_excerpt, 'This is a subtitle of some sort');
|
|
47
|
+
assert.equal(post.data.status, 'published');
|
|
48
|
+
assert.equal(post.data.created_at.toISOString(), '2018-08-11T11:23:34.123Z');
|
|
49
|
+
assert.equal(post.data.published_at.toISOString(), '2018-08-11T11:23:34.123Z');
|
|
50
|
+
assert.equal(post.data.updated_at.toISOString(), '2018-08-11T11:23:34.123Z');
|
|
51
|
+
assert.equal(post.data.comment_id, 'efefef12121212');
|
|
52
|
+
assert.match(post.data.html, /^<section name="007"/);
|
|
53
|
+
assert.match(post.data.html, /<\/section>$/);
|
|
54
|
+
assertMediumMetaObject(post.data.author);
|
|
55
|
+
assert.equal(post.data.author.url, 'https://medium.com/@JoeBloggs');
|
|
56
|
+
assert.equal(post.data.author.data.name, 'Joe Bloggs');
|
|
57
|
+
assert.equal(post.data.author.data.slug, 'joebloggs');
|
|
58
|
+
assert.equal(post.data.author.data.roles[0], 'Contributor');
|
|
59
|
+
assert.equal(post.data.tags.length, 3);
|
|
60
|
+
assertMediumMetaObject(post.data.tags[0]);
|
|
61
|
+
assert.equal(post.data.tags[0].url, 'https://medium.com/tag/things');
|
|
62
|
+
assert.equal(post.data.tags[0].data.name, 'Things');
|
|
63
|
+
assert.equal(post.data.tags[0].data.slug, 'things');
|
|
64
|
+
assertMediumMetaObject(post.data.tags[1]);
|
|
65
|
+
assert.equal(post.data.tags[1].url, 'https://medium.com/tag/stuff');
|
|
66
|
+
assert.equal(post.data.tags[1].data.name, 'Stuff');
|
|
67
|
+
assert.equal(post.data.tags[1].data.slug, 'stuff');
|
|
68
|
+
assert.equal(post.data.tags[2].data.name, '#medium');
|
|
69
|
+
});
|
|
70
|
+
it('Can process a draft medium post', function () {
|
|
71
|
+
const fixture = readSync('draft-post.html');
|
|
72
|
+
const fakeName = 'draft_blog-post-title-ababab121212.html';
|
|
73
|
+
const post = processPost({
|
|
74
|
+
name: fakeName,
|
|
75
|
+
html: fixture,
|
|
76
|
+
options: {
|
|
77
|
+
addPlatformTag: true
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
assertMediumMetaObject(post);
|
|
81
|
+
assert.equal(post.url, 'https://medium.com/p/ababab12121212');
|
|
82
|
+
assert.equal(post.data.title, 'Draft Post Title');
|
|
83
|
+
assert.equal(post.data.slug, 'blog-post-title');
|
|
84
|
+
assert.equal(post.data.custom_excerpt, 'This is a subtitle of some sort');
|
|
85
|
+
assert.equal(post.data.status, 'draft');
|
|
86
|
+
assert.equal(post.data.comment_id, 'ababab121212');
|
|
87
|
+
assert.match(post.data.html, /^<section name="007"/);
|
|
88
|
+
assert.match(post.data.html, /<\/section>$/);
|
|
89
|
+
assert.equal(post.data.tags.length, 1);
|
|
90
|
+
assert.equal(post.data.tags[0].data.name, '#medium');
|
|
91
|
+
// Drafts don't have these, and are dated when the export was read
|
|
92
|
+
assert.equal(post.data.published_at, undefined);
|
|
93
|
+
assert.equal(post.data.author, undefined);
|
|
94
|
+
assert.equal(post.data.created_at, DATE);
|
|
95
|
+
assert.equal(post.data.updated_at, DATE);
|
|
96
|
+
});
|
|
97
|
+
it('Can do advanced content processing on medium posts', function () {
|
|
98
|
+
const fixture = readSync('advanced-post.html');
|
|
99
|
+
const fakeName = '2018-08-11_blog-post-title-efefef121212.html';
|
|
100
|
+
const post = processPost({
|
|
101
|
+
name: fakeName,
|
|
102
|
+
html: fixture,
|
|
103
|
+
options: {
|
|
104
|
+
addPlatformTag: true
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
assertMediumMetaObject(post);
|
|
108
|
+
const html = post.data.html;
|
|
109
|
+
const firstDivRegex = /^<section name="007" class="section section--body section--first">[^\w<>]+<div class="(.*?)"/;
|
|
110
|
+
// should start with a section followed by a div
|
|
111
|
+
assert.match(html, firstDivRegex);
|
|
112
|
+
// the first div should not be a section divider anymore (what's in the fixture)
|
|
113
|
+
assert.notEqual(html.match(firstDivRegex)[1], 'section-divider');
|
|
114
|
+
// this is what we expect instead
|
|
115
|
+
assert.equal(html.match(firstDivRegex)[1], 'section-content');
|
|
116
|
+
// should not contain a header with the post title
|
|
117
|
+
assert.doesNotMatch(html, /<h3[^>]*>Blog Post Title/);
|
|
118
|
+
// should have feature image with caption & alt text
|
|
119
|
+
assert.equal(post.data.feature_image, 'https://cdn-images-1.medium.com/max/2000/abc123.jpeg');
|
|
120
|
+
assert.equal(post.data.feature_image_alt, 'This is image alt text');
|
|
121
|
+
assert.equal(post.data.feature_image_caption, 'This is an image caption');
|
|
122
|
+
assert.equal(post.data.tags.length, 4);
|
|
123
|
+
assert.equal(post.data.tags[0].data.name, 'Things');
|
|
124
|
+
assert.equal(post.data.tags[1].data.name, 'Stuff');
|
|
125
|
+
assert.equal(post.data.tags[2].data.name, '#medium');
|
|
126
|
+
assert.equal(post.data.tags[3].data.name, '#auto-feature-image');
|
|
127
|
+
});
|
|
128
|
+
it('Can detect comment', function () {
|
|
129
|
+
const fixture = readSync('comment.html');
|
|
130
|
+
const fakeName = '2018-08-11_blog-comment-efefef121212.html';
|
|
131
|
+
const post = processPost({
|
|
132
|
+
name: fakeName,
|
|
133
|
+
html: fixture,
|
|
134
|
+
options: {
|
|
135
|
+
addPlatformTag: true
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
assert.equal(post.data.status, 'draft');
|
|
139
|
+
assert.equal(post.data.tags[1].data.name, '#Medium Possible Comment');
|
|
140
|
+
});
|
|
141
|
+
it('Can detect comment 2', function () {
|
|
142
|
+
const fixture = readSync('short-post.html');
|
|
143
|
+
const fakeName = '2018-08-11_blog-short-post-efefef121212.html';
|
|
144
|
+
const post = processPost({
|
|
145
|
+
name: fakeName,
|
|
146
|
+
html: fixture,
|
|
147
|
+
options: {
|
|
148
|
+
addPlatformTag: true
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
assert.equal(post.data.status, 'published');
|
|
152
|
+
});
|
|
153
|
+
it('Can not add platform tags', function () {
|
|
154
|
+
const fixture = readSync('advanced-post.html');
|
|
155
|
+
const fakeName = '2018-08-11_blog-post-title-efefef121212.html';
|
|
156
|
+
const post = processPost({ name: fakeName, html: fixture });
|
|
157
|
+
assert.equal(post.data.tags.length, 2);
|
|
158
|
+
assert.equal(post.data.tags[0].data.name, 'Things');
|
|
159
|
+
assert.equal(post.data.tags[1].data.name, 'Stuff');
|
|
160
|
+
});
|
|
161
|
+
it('Can add a custom tag at the start', function () {
|
|
162
|
+
const fixture = readSync('advanced-post.html');
|
|
163
|
+
const fakeName = '2018-08-11_blog-post-title-efefef121212.html';
|
|
164
|
+
const post = processPost({
|
|
165
|
+
name: fakeName,
|
|
166
|
+
html: fixture,
|
|
167
|
+
options: {
|
|
168
|
+
addTag: 'This is my custom tag',
|
|
169
|
+
addPlatformTag: true
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
assert.equal(post.data.tags.length, 5);
|
|
173
|
+
assert.equal(post.data.tags[0].data.name, 'This is my custom tag');
|
|
174
|
+
assert.equal(post.data.tags[1].data.name, 'Things');
|
|
175
|
+
assert.equal(post.data.tags[2].data.name, 'Stuff');
|
|
176
|
+
assert.equal(post.data.tags[3].data.name, '#medium');
|
|
177
|
+
assert.equal(post.data.tags[4].data.name, '#auto-feature-image');
|
|
178
|
+
});
|
|
179
|
+
it('Can process blockquotes', function () {
|
|
180
|
+
const fixture = readSync('quote-post.html');
|
|
181
|
+
const fakeName = '2018-08-11_blog-post-title-efefef121212.html';
|
|
182
|
+
const post = processPost({ name: fakeName, html: fixture });
|
|
183
|
+
assertMediumMetaObject(post);
|
|
184
|
+
const html = post.data.html;
|
|
185
|
+
assert.ok(html.includes('<blockquote><p>“Lorem Ipsum” <a href="https://example/com" rel="noopener" target="_blank">Example</a></p></blockquote>'));
|
|
186
|
+
assert.ok(html.includes('<blockquote><p>Lorem Ipsum</p></blockquote>'));
|
|
187
|
+
});
|
|
188
|
+
it('Can use Medium as canonical link', function () {
|
|
189
|
+
const fixture = readSync('basic-post.html');
|
|
190
|
+
const fakeName = '2018-08-11_blog-post-title-efefef121212.html';
|
|
191
|
+
const post = processPost({
|
|
192
|
+
name: fakeName,
|
|
193
|
+
html: fixture,
|
|
194
|
+
options: {
|
|
195
|
+
mediumAsCanonical: true
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
assert.equal(post.data.canonical_url, 'https://medium.com/@JoeBloggs/testpost-efefef12121212');
|
|
199
|
+
});
|
|
200
|
+
it('does remove the subtitle if used as excerpt', function () {
|
|
201
|
+
const fixture = readSync('advanced-post.html');
|
|
202
|
+
const fakeName = '2018-08-11_blog-post-title-efefef121212.html';
|
|
203
|
+
const post = processPost({
|
|
204
|
+
name: fakeName,
|
|
205
|
+
html: fixture,
|
|
206
|
+
options: {
|
|
207
|
+
addTag: 'This is my custom tag',
|
|
208
|
+
addPlatformTag: true
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
// "This is a subtitle of some sort" is already used as excerpt, so don't include it in the content
|
|
212
|
+
assert.ok(!post.data.html.includes('<h4 name="456" id="456" class="graf graf--h4 graf-after--h3 graf--subtitle">This is a subtitle of some sort</h4>'));
|
|
213
|
+
});
|
|
214
|
+
it('Can fall back to filename for slug when canonical URL has no slug', function () {
|
|
215
|
+
const fixture = readSync('no-slug-post.html');
|
|
216
|
+
const fakeName = '2018-08-11_my-post-title-efefef121212.html';
|
|
217
|
+
const post = processPost({ name: fakeName, html: fixture, options: {} });
|
|
218
|
+
assert.equal(post.data.slug, 'my-post-title');
|
|
219
|
+
assert.equal(post.data.status, 'published');
|
|
220
|
+
});
|
|
221
|
+
it('Can handle published post with no datetime', function () {
|
|
222
|
+
const fixture = readSync('no-date-post.html');
|
|
223
|
+
const fakeName = '2018-08-11_no-date-post-efefef121212.html';
|
|
224
|
+
const post = processPost({ name: fakeName, html: fixture, options: {} });
|
|
225
|
+
assert.equal(post.data.status, 'published');
|
|
226
|
+
assert.equal(post.data.created_at, DATE);
|
|
227
|
+
assert.equal(post.data.published_at, DATE);
|
|
228
|
+
assert.equal(post.data.updated_at, DATE);
|
|
229
|
+
});
|
|
230
|
+
it('Can handle post with no e-content or title', function () {
|
|
231
|
+
const html = `<!DOCTYPE html><html><body>
|
|
232
|
+
<article class="h-entry">
|
|
233
|
+
<section class="p-summary">Summary</section>
|
|
234
|
+
<footer>
|
|
235
|
+
<p>By <a href="https://medium.com/@test" class="p-author h-card">Test</a> on <a><time class="dt-published" datetime="2020-01-01T00:00:00.000Z">Jan 1</time></a>.</p>
|
|
236
|
+
<p><a href="https://medium.com/@test/post-abc123" class="p-canonical">Link</a></p>
|
|
237
|
+
</footer>
|
|
238
|
+
</article>
|
|
239
|
+
</body></html>`;
|
|
240
|
+
const post = processPost({ name: '2020-01-01_post-abc123.html', html, options: {} });
|
|
241
|
+
assert.equal(post.data.html, '');
|
|
242
|
+
assert.equal(post.data.title, '');
|
|
243
|
+
});
|
|
244
|
+
it('Can handle feature image not inside a figure', function () {
|
|
245
|
+
const html = `<!DOCTYPE html><html><body>
|
|
246
|
+
<article class="h-entry">
|
|
247
|
+
<header><h1 class="p-name">Test</h1></header>
|
|
248
|
+
<section class="p-summary">Summary</section>
|
|
249
|
+
<section class="e-content">
|
|
250
|
+
<img data-is-featured src="https://example.com/photo.jpg">
|
|
251
|
+
<p>Content here.</p>
|
|
252
|
+
</section>
|
|
253
|
+
<footer>
|
|
254
|
+
<p>By <a href="https://medium.com/@test" class="p-author h-card">Test</a> on <a><time class="dt-published" datetime="2020-01-01T00:00:00.000Z">Jan 1</time></a>.</p>
|
|
255
|
+
<p><a href="https://medium.com/@test/post-abc123" class="p-canonical">Link</a></p>
|
|
256
|
+
</footer>
|
|
257
|
+
</article>
|
|
258
|
+
</body></html>`;
|
|
259
|
+
const post = processPost({ name: '2020-01-01_post-abc123.html', html, options: {} });
|
|
260
|
+
assert.equal(post.data.feature_image, 'https://example.com/photo.jpg');
|
|
261
|
+
});
|
|
262
|
+
it('Can handle feature image with no alt or caption', function () {
|
|
263
|
+
const fixture = readSync('basic-post.html');
|
|
264
|
+
const fakeName = '2018-08-11_blog-post-title-efefef121212.html';
|
|
265
|
+
// Inject a data-is-featured image with no alt and no figcaption
|
|
266
|
+
const modifiedFixture = fixture.replace('<div class="section-content">', '<div class="section-content"><figure><img data-is-featured src="https://example.com/photo.jpg"></figure>');
|
|
267
|
+
const post = processPost({ name: fakeName, html: modifiedFixture, options: {} });
|
|
268
|
+
assert.equal(post.data.feature_image, 'https://example.com/photo.jpg');
|
|
269
|
+
assert.equal(post.data.feature_image_alt, null);
|
|
270
|
+
assert.equal(post.data.feature_image_caption, null);
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
describe('Process Content', function () {
|
|
274
|
+
it('Can process code blocks', function () {
|
|
275
|
+
const source = `<pre name="4a0a" id="4a0a" class="graf graf--pre graf-after--p">
|
|
276
|
+
<code class="markup--code markup--pre-code">
|
|
277
|
+
<div class="image-block">\n <a href="https://example.com">\n <img src="/images/photo.jpg" alt="My alt text">\n </a>\n</div>
|
|
278
|
+
</code>
|
|
279
|
+
</pre>`;
|
|
280
|
+
const post = processContent({
|
|
281
|
+
html: source,
|
|
282
|
+
post: {
|
|
283
|
+
data: {
|
|
284
|
+
title: 'Blog Post Title'
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
assert.equal(post.data.html, `<pre><code><div class="image-block">\n <a href="https://example.com">\n <img src="/images/photo.jpg" alt="My alt text">\n </a>\n</div></code></pre>`);
|
|
289
|
+
});
|
|
290
|
+
it('Can process code blocks with slashes', function () {
|
|
291
|
+
const source = readSync('code-post.html');
|
|
292
|
+
const contentHtml = extractEContent(source);
|
|
293
|
+
const post = processContent({
|
|
294
|
+
html: contentHtml,
|
|
295
|
+
post: {
|
|
296
|
+
data: {
|
|
297
|
+
title: 'Blog Post Title'
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
assert.ok(!post.data.html.includes('<pre name="4a0a" id="4a0a" class="graf graf--pre graf-after--p">'));
|
|
302
|
+
assert.ok(post.data.html.includes('<pre><code>sudo apt-get update \n' +
|
|
303
|
+
'sudo apt-get install \\ \n' +
|
|
304
|
+
' apt-transport-https \\ \n' +
|
|
305
|
+
' ca-certificates \\ \n' +
|
|
306
|
+
' curl \\ \n' +
|
|
307
|
+
' gnupg-agent \\ \n' +
|
|
308
|
+
' software-properties-common \\ \n' +
|
|
309
|
+
' example \\ \n' +
|
|
310
|
+
' python3-example-lorem</code></pre>'));
|
|
311
|
+
});
|
|
312
|
+
it('Can process consecutive code blocks', function () {
|
|
313
|
+
const source = readSync('code-post.html');
|
|
314
|
+
const contentHtml = extractEContent(source);
|
|
315
|
+
const post = processContent({
|
|
316
|
+
html: contentHtml,
|
|
317
|
+
post: {
|
|
318
|
+
data: {
|
|
319
|
+
title: 'Blog Post Title'
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
assert.ok(!post.data.html.includes('<pre name="9a1f" id="9a1f" class="graf graf--pre graf-after--pre">'));
|
|
324
|
+
assert.ok(post.data.html.includes('<pre><code>echo "deb https://sub.example.com/ce/dolor lorem ipsum" |\\ \n' +
|
|
325
|
+
'sudo tee /etc/apt/sources.list.d/example.list \n' +
|
|
326
|
+
'sudo apt-get update \n' +
|
|
327
|
+
'sudo apt-get install example</code></pre>'));
|
|
328
|
+
});
|
|
329
|
+
it('Can process code blocks with language', function () {
|
|
330
|
+
const source = `<p>My content</p>
|
|
331
|
+
<pre data-code-block-mode="2" spellcheck="false" data-code-block-lang="bash" name="2296" id="2296" class="graf graf--pre graf-after--p graf--preV2">
|
|
332
|
+
<span class="pre--content">wget https://example.com/package.zip</span>
|
|
333
|
+
</pre>`;
|
|
334
|
+
const post = processContent({
|
|
335
|
+
html: source,
|
|
336
|
+
post: {
|
|
337
|
+
data: {
|
|
338
|
+
title: 'Blog Post Title'
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
assert.ok(!post.data.html.includes('<pre data-code-block-mode="2" spellcheck="false" data-code-block-lang="bash" name="2296" id="2296" class="graf graf--pre graf-after--p graf--preV2">\n' +
|
|
343
|
+
'<span class="pre--content">wget https://example.com/package.zip</span>\n' +
|
|
344
|
+
'</pre>'));
|
|
345
|
+
assert.ok(post.data.html.includes('<pre><code class="language-bash">wget https://example.com/package.zip</code></pre>'));
|
|
346
|
+
});
|
|
347
|
+
it('Can process galleries', function () {
|
|
348
|
+
const source = `<div class="section-inner sectionLayout--outsetRow" data-paragraph-count="3">
|
|
349
|
+
<figure name="f106" id="f106" class="graf graf--figure graf--layoutOutsetRow is-partialWidth graf-after--li" style="width: 34.74%;">
|
|
350
|
+
<img class="graf-image" data-image-id="1*1234.jpeg" data-width="768" data-height="933" src="https://cdn-images-1.medium.com/max/600/1*1234.jpeg">
|
|
351
|
+
</figure>
|
|
352
|
+
<figure name="13ec" id="13ec" class="graf graf--figure graf--layoutOutsetRowContinue is-partialWidth graf-after--figure" style="width: 31.659%;">
|
|
353
|
+
<img class="graf-image" data-image-id="1*5678.jpeg" data-width="768" data-height="1024" src="https://cdn-images-1.medium.com/max/400/1*5678.jpeg">
|
|
354
|
+
</figure>
|
|
355
|
+
<figure name="4dc5" id="4dc5" class="graf graf--figure graf--layoutOutsetRowContinue is-partialWidth graf-after--figure" style="width: 33.601%;">
|
|
356
|
+
<img class="graf-image" data-image-id="1*-abcd.jpeg" data-width="768" data-height="965" src="https://cdn-images-1.medium.com/max/600/1*-abcd.jpeg">
|
|
357
|
+
<figcaption class="imageCaption" style="width: 297.61%; left: -197.61%;">Photos by the author</figcaption>
|
|
358
|
+
</figure>
|
|
359
|
+
</div>`;
|
|
360
|
+
const post = processContent({
|
|
361
|
+
html: source,
|
|
362
|
+
post: {
|
|
363
|
+
data: {
|
|
364
|
+
title: 'Blog Post Title'
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
assert.ok(!post.data.html.includes('<div class="section-inner sectionLayout--outsetRow" data-paragraph-count="3">'));
|
|
369
|
+
assert.ok(post.data.html.includes('<figure class="kg-card kg-gallery-card kg-width-wide kg-card-hascaption"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://cdn-images-1.medium.com/max/600/1*1234.jpeg" width="768" height="933" loading="lazy" alt></div><div class="kg-gallery-image"><img src="https://cdn-images-1.medium.com/max/400/1*5678.jpeg" width="768" height="1024" loading="lazy" alt></div><div class="kg-gallery-image"><img src="https://cdn-images-1.medium.com/max/600/1*-abcd.jpeg" width="768" height="965" loading="lazy" alt></div></div></div><figcaption>Photos by the author</figcaption></figure>'));
|
|
370
|
+
});
|
|
371
|
+
it('Can process embeds with images', function () {
|
|
372
|
+
const source = `<div name="d38c" id="d38c" class="graf graf--mixtapeEmbed graf-after--p graf--trailing"><a
|
|
373
|
+
href="https://example.medium.com/list/1234"
|
|
374
|
+
data-href="https://example.medium.com/list/1234"
|
|
375
|
+
class="markup--anchor markup--mixtapeEmbed-anchor"
|
|
376
|
+
title="https://example.medium.com/list/1234"><strong
|
|
377
|
+
class="markup--strong markup--mixtapeEmbed-strong">My best Articles</strong><br>
|
|
378
|
+
class="markup--em markup--mixtapeEmbed-em"><em class="markup--em markup--mixtapeEmbed-em">A description</em>example.medium.com</a><a
|
|
379
|
+
href="https://example.medium.com/list/1234"
|
|
380
|
+
class="js-mixtapeImage mixtapeImage mixtapeImage--mediumCatalog u-ignoreBlock"
|
|
381
|
+
data-media-id="abcd1234"
|
|
382
|
+
data-thumbnail-img-id="0*5678.jpeg"
|
|
383
|
+
style="background-image: url(https://cdn-images-1.medium.com/fit/c/304/160/0*5678.jpeg);"></a>
|
|
384
|
+
</div>`;
|
|
385
|
+
const post = processContent({
|
|
386
|
+
html: source,
|
|
387
|
+
post: {
|
|
388
|
+
data: {
|
|
389
|
+
title: 'Blog Post Title'
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
assert.ok(!post.data.html.includes('<div name="d38c" id="d38c" class="graf graf--mixtapeEmbed graf-after--p graf--trailing">'));
|
|
394
|
+
assert.ok(post.data.html.includes('<figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://example.medium.com/list/1234"><div class="kg-bookmark-content"><div class="kg-bookmark-title">My best Articles</div><div class="kg-bookmark-description">A description</div><div class="kg-bookmark-metadata"></div></div><div class="kg-bookmark-thumbnail"><img src="https://cdn-images-1.medium.com/fit/c/304/160/0*5678.jpeg" alt></div></a></figure>'));
|
|
395
|
+
});
|
|
396
|
+
it('Can process embeds without images', function () {
|
|
397
|
+
const source = `<div name="c123" id="c123" class="graf graf--mixtapeEmbed graf-after--p">
|
|
398
|
+
<a href="https://example.com/lorem/ipsum" data-href="https://example.com/lorem/ipsum" class="markup--anchor markup--mixtapeEmbed-anchor" title="https://example.com/lorem/ipsum">
|
|
399
|
+
<strong class="markup--strong markup--mixtapeEmbed-strong">lorem/ipsum</strong>
|
|
400
|
+
<br>
|
|
401
|
+
<em class="markup--em markup--mixtapeEmbed-em">Dolor Simet.</em>
|
|
402
|
+
example.com
|
|
403
|
+
</a>
|
|
404
|
+
<a href="https://example.com/lorem/ipsum" class="js-mixtapeImage mixtapeImage mixtapeImage--empty u-ignoreBlock" data-media-id="abcd1234"></a>
|
|
405
|
+
</div>`;
|
|
406
|
+
const post = processContent({
|
|
407
|
+
html: source,
|
|
408
|
+
post: {
|
|
409
|
+
data: {
|
|
410
|
+
title: 'Blog Post Title'
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
assert.ok(!post.data.html.includes('<div name="c123" id="c123" class="graf graf--mixtapeEmbed graf-after--p">'));
|
|
415
|
+
assert.ok(post.data.html.includes('<figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://example.com/lorem/ipsum"><div class="kg-bookmark-content"><div class="kg-bookmark-title">lorem/ipsum</div><div class="kg-bookmark-description">Dolor Simet.</div><div class="kg-bookmark-metadata"></div></div></a></figure>'));
|
|
416
|
+
});
|
|
417
|
+
it('Can process embed with minimal markup', function () {
|
|
418
|
+
const source = `<div class="graf graf--mixtapeEmbed">
|
|
419
|
+
<a href="https://example.com" class="markup--anchor">example.com</a>
|
|
420
|
+
</div>`;
|
|
421
|
+
const post = processContent({
|
|
422
|
+
html: source,
|
|
423
|
+
post: {
|
|
424
|
+
data: {
|
|
425
|
+
title: 'Test'
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
assert.ok(post.data.html.includes('kg-card-begin'));
|
|
430
|
+
assert.ok(!post.data.html.includes('graf--mixtapeEmbed'));
|
|
431
|
+
});
|
|
432
|
+
it('Can process blockquotes in 2 parts', function () {
|
|
433
|
+
const source = `<p>Not quote text</p>
|
|
434
|
+
<blockquote name="68bf" id="68bf" class="graf graf--pullquote graf-after--p graf--trailing">Standalone quote</blockquote>
|
|
435
|
+
<p>Also not quote text</p>
|
|
436
|
+
<blockquote name="3755" id="3755" class="graf graf--pullquote graf--startsWithDoubleQuote graf-after--li">"Main quote."</blockquote>
|
|
437
|
+
<blockquote name="8d9f" id="8d9f" class="graf graf--pullquote graf-after--pullquote graf--trailing">\u2014 <a href="https://example.com/source" data-href="https://example.com/source" class="markup--anchor markup--pullquote-anchor" rel="noopener" target="_blank">Person Name</a></blockquote>`;
|
|
438
|
+
const post = processContent({
|
|
439
|
+
html: source,
|
|
440
|
+
post: {
|
|
441
|
+
data: {
|
|
442
|
+
title: 'Blog Post Title'
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
assert.ok(!post.data.html.includes('<blockquote name="68bf" id="68bf" class="graf graf--pullquote graf-after--p graf--trailing">Standalone quote</blockquote>'));
|
|
447
|
+
assert.ok(!post.data.html.includes('<blockquote name="3755" id="3755" class="graf graf--pullquote graf--startsWithDoubleQuote graf-after--li">"Main quote."</blockquote>'));
|
|
448
|
+
assert.ok(post.data.html.includes('<blockquote><p>Standalone quote</p></blockquote>'));
|
|
449
|
+
assert.ok(post.data.html.includes('<blockquote><p>"Main quote."<br><br>\u2014 <a href="https://example.com/source" data-href="https://example.com/source" class="markup--anchor markup--pullquote-anchor" rel="noopener" target="_blank">Person Name</a></p></blockquote>'));
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
describe('Post identity, dates and authors', function () {
|
|
453
|
+
const page = (footer, header = '<h1 class="p-name">Title</h1>') => `<html><body><article class="h-entry"><header>${header}</header><section class="e-content"><p>One.</p><p>Two.</p></section><footer>${footer}</footer></article></body></html>`;
|
|
454
|
+
it('reads the post ID from the file name when there is no canonical link', function () {
|
|
455
|
+
const post = processPost({
|
|
456
|
+
name: 'posts/2020-01-01_From-The-Name-abc123.html',
|
|
457
|
+
html: page('<p>By someone</p>'),
|
|
458
|
+
options: { mediumAsCanonical: true }
|
|
459
|
+
});
|
|
460
|
+
assert.equal(post.url, undefined);
|
|
461
|
+
assert.equal(post.data.slug, 'from-the-name');
|
|
462
|
+
assert.equal(post.data.comment_id, 'abc123');
|
|
463
|
+
assert.equal(post.data.canonical_url, undefined);
|
|
464
|
+
});
|
|
465
|
+
it('rejects posts without a Medium post ID', function () {
|
|
466
|
+
assert.throws(() => processPost({ name: 'posts/no-id.html', html: page('<p>By someone</p>') }), (error) => error instanceof RecordDataError && /No Medium post ID in the canonical URL/.test(error.message));
|
|
467
|
+
assert.throws(() => processPost({ name: 'posts/draft_no-id.html', html: page('') }), RecordDataError);
|
|
468
|
+
});
|
|
469
|
+
it('rejects an invalid publish date', function () {
|
|
470
|
+
const html = page('<time class="dt-published" datetime="not a date">Never</time><a class="p-canonical" href="https://medium.com/@a/post-abc123">Link</a>');
|
|
471
|
+
assert.throws(() => processPost({ name: 'posts/2020-01-01_post-abc123.html', html }), (error) => error instanceof RecordDataError && error.message === 'Invalid Medium publish date');
|
|
472
|
+
});
|
|
473
|
+
it('keeps an author link without a Medium handle unslugged', function () {
|
|
474
|
+
const html = page('<a class="p-author h-card" href="https://example.com/writer"> Jo Writer </a><a class="p-canonical" href="https://medium.com/@a/post-abc123">Link</a>');
|
|
475
|
+
const post = processPost({ name: 'posts/2020-01-01_post-abc123.html', html });
|
|
476
|
+
assert.deepEqual(post.data.author, {
|
|
477
|
+
url: 'https://example.com/writer',
|
|
478
|
+
data: { name: 'Jo Writer', slug: undefined, roles: ['Contributor'] }
|
|
479
|
+
});
|
|
480
|
+
assert.equal(post.data.title, 'Title');
|
|
481
|
+
const bare = processPost({
|
|
482
|
+
name: 'posts/2020-01-01_post-abc123.html',
|
|
483
|
+
html: page('<p class="p-tags"><a class="p-tag">Untagged</a></p><a class="p-author h-card">Nobody</a><a class="p-canonical" href="https://medium.com/@a/post-abc123">Link</a>')
|
|
484
|
+
});
|
|
485
|
+
assert.deepEqual(bare.data.author, {
|
|
486
|
+
url: undefined,
|
|
487
|
+
data: { name: 'Nobody', slug: undefined, roles: ['Contributor'] }
|
|
488
|
+
});
|
|
489
|
+
assert.deepEqual(bare.data.tags, [{ url: '', data: { name: 'Untagged', slug: '' } }]);
|
|
490
|
+
});
|
|
491
|
+
it('gives a draft without a footer link no URL', function () {
|
|
492
|
+
const post = processPost({ name: 'posts/draft_A-Draft-abc123.html', html: page('<p>Nothing</p>') });
|
|
493
|
+
assert.equal(post.url, undefined);
|
|
494
|
+
assert.equal(post.data.slug, 'a-draft');
|
|
495
|
+
});
|
|
496
|
+
it('finds Medium handles and canonical URLs', function () {
|
|
497
|
+
assert.equal(mediumHandle('https://medium.com/@JoeBloggs'), 'joebloggs');
|
|
498
|
+
assert.equal(mediumHandle('https://medium.com/@Joe.Bloggs/post-abc?source=x'), 'joe.bloggs');
|
|
499
|
+
assert.equal(mediumHandle('https://example.com/writer'), undefined);
|
|
500
|
+
assert.equal(mediumHandle(undefined), undefined);
|
|
501
|
+
assert.equal(postUrl(readSync('basic-post.html')), 'https://medium.com/@JoeBloggs/testpost-efefef12121212');
|
|
502
|
+
assert.equal(postUrl(readSync('draft-post.html')), undefined);
|
|
503
|
+
});
|
|
504
|
+
});
|
|
505
|
+
//# sourceMappingURL=process.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.test.js","sourceRoot":"","sources":["../../src/test/process.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,QAAQ,EAAE,EAAE,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AACrC,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AACvC,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAC,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,IAAI,WAAW,EAAC,MAAM,aAAa,CAAC;AAG9F,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,uCAAuC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAClG,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,0BAA0B,CAAC,CAAC;AAElD,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE;IAC9B,OAAO,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAwD,EAAE,EAAE,CACjG,WAAW,CAAC,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;AAEnD,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE;IACrC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AE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAC,EAAC,CAAC,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE;QAC7C,MAAM,IAAI,GAAG,WAAW,CAAC,EAAC,IAAI,EAAE,iCAAiC,EAAE,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAC,CAAC,CAAC;QAElG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE;QAC1C,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,+BAA+B,CAAC,EAAE,WAAW,CAAC,CAAC;QACzE,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,kDAAkD,CAAC,EAAE,YAAY,CAAC,CAAC;QAC7F,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,4BAA4B,CAAC,EAAE,SAAS,CAAC,CAAC;QACpE,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;QACjD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,EAAE,uDAAuD,CAAC,CAAC;QAC5G,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/mg-medium-export",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.28.0-0",
|
|
4
|
+
"description": "Migrate content from a Medium export to Ghost",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/TryGhost/migrate.git",
|
|
@@ -9,27 +9,37 @@
|
|
|
9
9
|
},
|
|
10
10
|
"author": "Ghost Foundation",
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"main": "index.js",
|
|
12
|
+
"main": "build/index.js",
|
|
13
13
|
"type": "module",
|
|
14
|
+
"types": "./build/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./build/index.d.ts",
|
|
18
|
+
"default": "./build/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
14
21
|
"files": [
|
|
15
|
-
"
|
|
16
|
-
"lib"
|
|
22
|
+
"build"
|
|
17
23
|
],
|
|
18
24
|
"publishConfig": {
|
|
19
25
|
"access": "public"
|
|
20
26
|
},
|
|
21
27
|
"devDependencies": {
|
|
22
|
-
"
|
|
28
|
+
"@types/node": "24.19.2",
|
|
29
|
+
"c8": "12.0.0",
|
|
30
|
+
"typescript": "7.0.2"
|
|
23
31
|
},
|
|
24
32
|
"dependencies": {
|
|
25
|
-
"@tryghost/
|
|
26
|
-
"@tryghost/mg-fs-utils": "0.
|
|
27
|
-
"@tryghost/mg-
|
|
28
|
-
"@tryghost/
|
|
33
|
+
"@tryghost/mg-context": "0.12.0-0",
|
|
34
|
+
"@tryghost/mg-fs-utils": "0.27.0-0",
|
|
35
|
+
"@tryghost/mg-ghost-authors": "0.11.0-0",
|
|
36
|
+
"@tryghost/mg-utils": "0.12.0-0",
|
|
37
|
+
"@tryghost/string": "0.3.8",
|
|
29
38
|
"simple-dom": "1.4.0"
|
|
30
39
|
},
|
|
31
40
|
"scripts": {
|
|
32
|
-
"
|
|
33
|
-
"test": "c8 --check-coverage --
|
|
41
|
+
"build": "tsc --build",
|
|
42
|
+
"test": "c8 --src src --all --check-coverage --100 --exclude '**/test/**' --exclude '**/*.d.ts' node --test 'build/test/**/*.test.js'",
|
|
43
|
+
"test:local": "pnpm build && pnpm test"
|
|
34
44
|
}
|
|
35
45
|
}
|
package/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import readZip, {contentStats} from './lib/read-zip.js';
|
|
2
|
-
import process from './lib/process.js';
|
|
3
|
-
|
|
4
|
-
export default (pathToZip, options) => {
|
|
5
|
-
let input = readZip(pathToZip, options);
|
|
6
|
-
let output = process(input, options);
|
|
7
|
-
|
|
8
|
-
return output;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export {contentStats};
|