Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): Upgrade remarkable to 2.0.1 #1329

Merged
merged 2 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

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": {
ConradJChan marked this conversation as resolved.
Show resolved Hide resolved
"highlightjs": "9.18.1",
"papaparse": "4.1.2",
"remarkable": "1.7.1"
"remarkable": "2.0.1"
}
}
1 change: 1 addition & 0 deletions src/third-party/text/2.65.0/remarkable.min.js

Large diffs are not rendered by default.