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 1 commit
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
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.64.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
2 changes: 1 addition & 1 deletion src/third-party/text/2.64.0/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"dependencies": {
"highlightjs": "9.18.1",
"papaparse": "4.1.2",
"remarkable": "1.7.1"
"remarkable": "2.0.1"
}
}
5 changes: 1 addition & 4 deletions src/third-party/text/2.64.0/remarkable.min.js

Large diffs are not rendered by default.