nodebb-plugin-markdown 9.0.3 → 9.0.4

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.
Files changed (2) hide show
  1. package/index.js +6 -0
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -6,6 +6,7 @@ const path = require('path');
6
6
  const url = require('url');
7
7
 
8
8
  const probe = require('probe-image-size');
9
+ const punycode = require('punycode');
9
10
 
10
11
  const nconf = require.main.require('nconf');
11
12
  const winston = require.main.require('winston');
@@ -401,6 +402,11 @@ const Markdown = {
401
402
  }
402
403
  }
403
404
 
405
+ // Convert any homographs in link text to punycode
406
+ if (tokens[idx + 1] && tokens[idx + 1].type === 'text') {
407
+ tokens[idx + 1].content = punycode.toASCII(tokens[idx + 1].content);
408
+ }
409
+
404
410
  return renderLink(tokens, idx, options, env, self);
405
411
  };
406
412
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-markdown",
3
- "version": "9.0.3",
3
+ "version": "9.0.4",
4
4
  "description": "A Markdown parser for NodeBB",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -34,7 +34,8 @@
34
34
  "markdown-it": "^12.0.6",
35
35
  "markdown-it-checkbox": "^1.1.0",
36
36
  "markdown-it-multimd-table": "^4.0.1",
37
- "probe-image-size": "^7.2.1"
37
+ "probe-image-size": "^7.2.1",
38
+ "punycode": "^2.1.1"
38
39
  },
39
40
  "nbbpm": {
40
41
  "compatibility": "^1.17.0"