nodebb-plugin-markdown 13.2.2 → 13.2.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.
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # NodeBB Markdown Parser
2
-
3
- This NodeBB plugin is a parser that allows users to write posts using [Markdown](https://daringfireball.net/projects/markdown/).
4
-
5
- To customise options for the parser, please consult the "Markdown" page in the administration panel, under the "Plugins" heading.
6
-
7
- ## Installation
8
-
9
- npm install nodebb-plugin-markdown
1
+ # NodeBB Markdown Parser
2
+
3
+ This NodeBB plugin is a parser that allows users to write posts using [Markdown](https://daringfireball.net/projects/markdown/).
4
+
5
+ To customise options for the parser, please consult the "Markdown" page in the administration panel, under the "Plugins" heading.
6
+
7
+ ## Installation
8
+
9
+ npm install nodebb-plugin-markdown
package/index.js CHANGED
@@ -64,9 +64,6 @@ const Markdown = {
64
64
  rel: 'prefetch stylesheet',
65
65
  type: '',
66
66
  href: `${nconf.get('relative_path')}/assets/plugins/nodebb-plugin-markdown/styles/${highlightTheme || 'default.css'}`,
67
- }, {
68
- rel: 'prefetch',
69
- href: `${nconf.get('relative_path')}/assets/language/${meta.config.defaultLang || 'en-GB'}/markdown.json?${meta.config['cache-buster']}`,
70
67
  });
71
68
 
72
69
  return hookData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-markdown",
3
- "version": "13.2.2",
3
+ "version": "13.2.4",
4
4
  "description": "A Markdown parser for NodeBB",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -51,7 +51,7 @@ export function prepareFormattingTools() {
51
51
  'translator',
52
52
  ], function (formatting, controls, translator) {
53
53
  if (formatting && controls) {
54
- translator.getTranslations(window.config.userLang || window.config.defaultLang, 'markdown', function (strings) {
54
+ translator.getTranslations(window.config.userLang, 'markdown', function (strings) {
55
55
  // used for h1,h2...h6
56
56
  function formatHeading(heading, textarea, selectionStart, selectionEnd) {
57
57
  if (selectionStart === selectionEnd) {
@@ -219,16 +219,23 @@ export function markExternalLinks() {
219
219
 
220
220
  const anchorEls = document.querySelectorAll('[component="post/content"] a');
221
221
  anchorEls.forEach((anchorEl) => {
222
- // Do nothing if the anchor contains only an image
223
- if (anchorEl.childElementCount === 1 && anchorEl.querySelector('img') && !anchorEl.text) {
222
+ const imageOnly = anchorEl.childElementCount === 1 && anchorEl.querySelector('img') && !anchorEl.text;
223
+ const iconAlreadyAdded = anchorEl.querySelector('.external-link-icon');
224
+ if (imageOnly || iconAlreadyAdded) {
224
225
  return;
225
226
  }
226
227
 
227
228
  // Otherwise, mark external links with icon
228
- const parsed = new URL(anchorEl.href, document.location.href);
229
+ let parsed;
230
+ try {
231
+ parsed = new URL(anchorEl.href, document.location.href);
232
+ } catch (err) {
233
+ return;
234
+ }
235
+
229
236
  if (parsed.host != document.location.host) {
230
237
  const iconEl = document.createElement('i');
231
- iconEl.classList.add('fa', 'fa-external-link', 'small');
238
+ iconEl.classList.add('fa', 'fa-external-link', 'small', 'external-link-icon');
232
239
  anchorEl.append(' ', iconEl);
233
240
  }
234
241
  });
@@ -1,12 +1,12 @@
1
- {
2
- "bold": "Fettschrift",
3
- "italic": "Kursivschrift",
4
- "list-item": "Listenpunkt",
5
- "strikethrough-text": "Durchgestrichen",
6
- "code-text": "code_text",
7
- "link-text": "Link Text",
8
- "link-url": "Link Adresse",
9
- "picture-text": "Bild Text",
10
- "picture-url": "Bild Link",
11
- "help-text": "Dieses Forum unterstützt Markdown. <a href=\"http://commonmark.org/help/\" class=\"text-decoration-underline\">Für mehr Informationen, hier klicken.</a>"
12
- }
1
+ {
2
+ "bold": "Fettschrift",
3
+ "italic": "Kursivschrift",
4
+ "list-item": "Listenpunkt",
5
+ "strikethrough-text": "Durchgestrichen",
6
+ "code-text": "code_text",
7
+ "link-text": "Link Text",
8
+ "link-url": "Link Adresse",
9
+ "picture-text": "Bild Text",
10
+ "picture-url": "Bild Link",
11
+ "help-text": "Dieses Forum unterstützt Markdown. <a href=\"http://commonmark.org/help/\" class=\"text-decoration-underline\">Für mehr Informationen, hier klicken.</a>"
12
+ }
@@ -1,13 +1,13 @@
1
- {
2
- "bold": "bolded text",
3
- "italic": "italicised text",
4
- "list-item": "list item",
5
- "heading": "heading",
6
- "strikethrough-text": "strikethrough text",
7
- "code-text": "code_text",
8
- "link-text": "link text",
9
- "link-url": "link url",
10
- "picture-text": "alt text",
11
- "picture-url": "image url",
12
- "help-text": "This forum is powered by Markdown. <a href=\"http://commonmark.org/help/\" class=\"text-decoration-underline\">For full documentation, click here.</a>"
1
+ {
2
+ "bold": "bolded text",
3
+ "italic": "italicised text",
4
+ "list-item": "list item",
5
+ "heading": "heading",
6
+ "strikethrough-text": "strikethrough text",
7
+ "code-text": "code_text",
8
+ "link-text": "link text",
9
+ "link-url": "link url",
10
+ "picture-text": "alt text",
11
+ "picture-url": "image url",
12
+ "help-text": "This forum is powered by Markdown. <a href=\"http://commonmark.org/help/\" class=\"text-decoration-underline\">For full documentation, click here.</a>"
13
13
  }
@@ -1,11 +1,11 @@
1
- {
2
- "bold": "متن پررنگ",
3
- "italic": "متن ایتالیک ( کج )",
4
- "list-item": "لیست",
5
- "strikethrough-text": "متن خط خورده",
6
- "link-text": "متن لینک",
7
- "link-url": "آدرس لینک",
8
- "picture-text": "متن جایگزین",
9
- "picture-url": "آدرس عکس",
10
- "help-text": "این انجمن از زبان مارک دون استفاده می کند، برای اطلاعات بیشتر [اینجا](http://commonmark.org/help/) کلیک کنید!"
11
- }
1
+ {
2
+ "bold": "متن پررنگ",
3
+ "italic": "متن ایتالیک ( کج )",
4
+ "list-item": "لیست",
5
+ "strikethrough-text": "متن خط خورده",
6
+ "link-text": "متن لینک",
7
+ "link-url": "آدرس لینک",
8
+ "picture-text": "متن جایگزین",
9
+ "picture-url": "آدرس عکس",
10
+ "help-text": "این انجمن از زبان مارک دون استفاده می کند، برای اطلاعات بیشتر [اینجا](http://commonmark.org/help/) کلیک کنید!"
11
+ }
@@ -1,11 +1,11 @@
1
- {
2
- "bold": "texte en gras",
3
- "italic": "texte en italique",
4
- "list-item": "élément de liste",
5
- "strikethrough-text": "strikethrough text",
6
- "link-text": "texte du lien",
7
- "link-url": "url du lien",
8
- "picture-text": "text alternatif",
9
- "picture-url": "url de l'image",
10
- "help-text": "Ce forum utilise la syntaxe Markdown. <a href=\"http://commonmark.org/help/\" class=\"text-decoration-underline\">Pour accéder à la documentation, suivre ce lien.</a>"
11
- }
1
+ {
2
+ "bold": "texte en gras",
3
+ "italic": "texte en italique",
4
+ "list-item": "élément de liste",
5
+ "strikethrough-text": "strikethrough text",
6
+ "link-text": "texte du lien",
7
+ "link-url": "url du lien",
8
+ "picture-text": "text alternatif",
9
+ "picture-url": "url de l'image",
10
+ "help-text": "Ce forum utilise la syntaxe Markdown. <a href=\"http://commonmark.org/help/\" class=\"text-decoration-underline\">Pour accéder à la documentation, suivre ce lien.</a>"
11
+ }
@@ -1,11 +1,11 @@
1
- {
2
- "bold": "pogrubienie",
3
- "italic": "pochylenie",
4
- "list-item": "wypunktowanie",
5
- "strikethrough-text": "przekreślenie",
6
- "link-text": "tekst odnośnika",
7
- "link-url": "url odnośnika",
8
- "picture-text": "text alternatywny",
9
- "picture-url": "url obrazu",
10
- "help-text": "Forum działa dzięki Markdown. <a href=\"http://commonmark.org/help/\" class=\"text-decoration-underline\">By uzyskać pełną dokumentację, kliknij tutaj.</a>"
11
- }
1
+ {
2
+ "bold": "pogrubienie",
3
+ "italic": "pochylenie",
4
+ "list-item": "wypunktowanie",
5
+ "strikethrough-text": "przekreślenie",
6
+ "link-text": "tekst odnośnika",
7
+ "link-url": "url odnośnika",
8
+ "picture-text": "text alternatywny",
9
+ "picture-url": "url obrazu",
10
+ "help-text": "Forum działa dzięki Markdown. <a href=\"http://commonmark.org/help/\" class=\"text-decoration-underline\">By uzyskać pełną dokumentację, kliknij tutaj.</a>"
11
+ }
@@ -1,11 +1,11 @@
1
- {
2
- "bold": "kalın yazı",
3
- "italic": "İtalik yazı",
4
- "list-item": "liste madde",
5
- "strikethrough-text": "Üstü çizili metin",
6
- "link-text": "bağlantı metni",
7
- "link-url": "link url",
8
- "picture-text": "alt metni",
9
- "picture-url": "görsel url",
10
- "help-text": "This forum is powered by Markdown. <a href=\"http://commonmark.org/help/\" class=\"text-decoration-underline\">For full documentation, click here.</a>"
11
- }
1
+ {
2
+ "bold": "kalın yazı",
3
+ "italic": "İtalik yazı",
4
+ "list-item": "liste madde",
5
+ "strikethrough-text": "Üstü çizili metin",
6
+ "link-text": "bağlantı metni",
7
+ "link-url": "link url",
8
+ "picture-text": "alt metni",
9
+ "picture-url": "görsel url",
10
+ "help-text": "This forum is powered by Markdown. <a href=\"http://commonmark.org/help/\" class=\"text-decoration-underline\">For full documentation, click here.</a>"
11
+ }