Skip to content

Commit

Permalink
build(deps): Upgrade remarkable to 2.0.1 (#1329)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conrad Chan committed Feb 22, 2021
1 parent 4f70945 commit df692c4
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ module.exports = {
DocumentTouch: false,
fail: false,
fixture: false,
hljs: false,
jest: false,
pdfjsLib: false,
pdfjsViewer: false,
remarkable: false,
sinon: false,
},
rules: {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const DOC_STATIC_ASSETS_VERSION = '2.16.0'; // v2.53.0 has font rendering
export const MEDIA_STATIC_ASSETS_VERSION = '2.14.0';
export const MODEL3D_STATIC_ASSETS_VERSION = '1.12.0';
export const SWF_STATIC_ASSETS_VERSION = '0.112.0';
export const TEXT_STATIC_ASSETS_VERSION = '2.64.0';
export const TEXT_STATIC_ASSETS_VERSION = '2.65.0';

export const PREVIEW_SCRIPT_NAME = 'preview.js';

Expand Down
6 changes: 2 additions & 4 deletions src/lib/viewers/text/MarkdownViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,12 @@ class MarkdownViewer extends PlainTextViewer {
* @return {Remarkable} Remarkable parser instance
*/
initRemarkable() {
/* global Remarkable */
const { linkify, Remarkable } = remarkable;
/* istanbul ignore next */
const md = new Remarkable({
breaks: true, // convert '\n' in paragraphs into <br>
linkify: true, // automatically URL-like text into links
linkTarget: '_blank', // open links in new page
typographer: true,
/* global hljs */
highlight: (str, lang) => {
// Syntax highlight with specified language if available
if (lang && hljs.getLanguage(lang)) {
Expand All @@ -133,7 +131,7 @@ class MarkdownViewer extends PlainTextViewer {
// Use default escaping if no highlighting was successful
return '';
},
});
}).use(linkify); // automatically converts URL-like text into links

// Custom renderer for links to add rel="noopener noreferrer"
const linkRenderer = md.renderer.rules.link_open;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/viewers/text/__tests__/MarkdownViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ControlsRoot from '../../controls/controls-root';
import MarkdownControls from '../MarkdownControls';
import MarkdownViewer from '../MarkdownViewer';
import Popup from '../../../Popup';
import Remarkable from '../../../../third-party/text/0.114.0/remarkable.min.js';
import { linkify, Remarkable } from '../../../../third-party/text/2.65.0/remarkable.min.js';
import { TEXT_STATIC_ASSETS_VERSION, SELECTOR_BOX_PREVIEW } from '../../../constants';
import { VIEWER_EVENT } from '../../../events';

Expand All @@ -19,7 +19,7 @@ describe('lib/viewers/text/MarkdownViewer', () => {
const setupFunc = BaseViewer.prototype.setup;

beforeAll(() => {
global.Remarkable = Remarkable;
global.remarkable = { linkify, Remarkable };
});

beforeEach(() => {
Expand Down
4 changes: 0 additions & 4 deletions src/third-party/text/2.64.0/remarkable.min.js

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "text",
"description": "Third-party static assets used for the Preview text viewers",
"version": "2.64.0",
"version": "2.65.0",
"dependencies": {
"highlightjs": "9.18.1",
"papaparse": "4.1.2",
"remarkable": "1.7.1"
"remarkable": "2.0.1"
}
}
File renamed without changes.
1 change: 1 addition & 0 deletions src/third-party/text/2.65.0/remarkable.min.js

Large diffs are not rendered by default.

0 comments on commit df692c4

Please sign in to comment.