@tryghost/mg-substack 1.2.0 → 1.3.1

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/lib/mapper.js CHANGED
@@ -22,6 +22,7 @@ const mapConfig = (data, options) => {
22
22
  substackData: data,
23
23
  data: {
24
24
  slug: slug,
25
+ comment_id: data.post_id.replace(/\..*$/, ''),
25
26
  published_at: data.post_date || dateNow,
26
27
  updated_at: data.post_date || dateNow,
27
28
  created_at: data.post_date || dateNow,
package/lib/process.js CHANGED
@@ -487,6 +487,25 @@ const processContent = (post, siteUrl, options) => {
487
487
  el.remove();
488
488
  });
489
489
 
490
+ parsed.$('.mention-wrap').forEach((el) => {
491
+ const attrsRaw = attr(el, 'data-attrs');
492
+
493
+ let attrs;
494
+
495
+ try {
496
+ attrs = JSON.parse(attrsRaw);
497
+ } catch (error) {
498
+ return;
499
+ }
500
+
501
+ const name = attrs.name;
502
+ const id = attrs.id;
503
+
504
+ if (name && id) {
505
+ replaceWith(el, `<a href="https://open.substack.com/users/${id}">${name}</a>`);
506
+ }
507
+ });
508
+
490
509
  parsed.$('.digest-post-embed').forEach((el) => {
491
510
  const attrsRaw = attr(el, 'data-attrs');
492
511
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/mg-substack",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/TryGhost/migrate.git",
@@ -29,8 +29,8 @@
29
29
  "html-entities": "2.6.0",
30
30
  "simple-dom": "1.4.0",
31
31
  "srcset": "5.0.3",
32
- "@tryghost/mg-utils": "0.7.0",
33
- "@tryghost/mg-fs-utils": "0.22.0"
32
+ "@tryghost/mg-fs-utils": "0.23.1",
33
+ "@tryghost/mg-utils": "0.8.1"
34
34
  },
35
35
  "scripts": {
36
36
  "dev": "echo \"Implement me!\"",