adjusted test for the new package version

Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
This commit is contained in:
Alexander Piskun 2023-09-24 00:56:03 +03:00
Родитель fe466b241d
Коммит 1c4388fd67
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 1F0BF0EC3CF22721
4 изменённых файлов: 4 добавлений и 7 удалений

Просмотреть файл

@ -1,4 +1,4 @@
import * as hljs from 'highlight.js';
import hljs from 'highlight.js';
import * as markdownit from 'markdown-it';
import {noReferrerLinks} from './Templating';
@ -7,7 +7,7 @@ export function renderMd(html: string): string {
highlight: (str, lang) => {
if (lang && hljs.getLanguage(lang)) {
try {
return hljs.highlight(lang, str).value;
return hljs.highlight(str, {language: lang, ignoreIllegals: false}).value;
} catch (e) {
console.error(e);
}

Просмотреть файл

@ -7,7 +7,7 @@ describe('Markdown rendering', () => {
const expected = '<p>' +
'<a href="http://google.com" rel="noopener noreferrer">link</a>' +
'</p>\n' +
'<pre><code class="language-js">alert(<span class="hljs-number">' +
'<pre><code class="language-js"><span class="hljs-title function_">alert</span>(<span class="hljs-number">' +
'1</span>);\n</code></pre>';
expect(renderMd(md).trim()).toEqual(expected.trim());
});

Просмотреть файл

@ -7,7 +7,6 @@ var hljs = require('highlight.js/lib/core');
hljs.registerLanguage('apache', require('highlight.js/lib/languages/apache'));
hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'));
hljs.registerLanguage('bash', require('highlight.js/lib/languages/bash'));
hljs.registerLanguage('c-like', require('highlight.js/lib/languages/c-like'));
hljs.registerLanguage('c', require('highlight.js/lib/languages/c'));
hljs.registerLanguage('clojure', require('highlight.js/lib/languages/clojure'));
hljs.registerLanguage('clojure-repl', require('highlight.js/lib/languages/clojure-repl'));
@ -33,7 +32,6 @@ hljs.registerLanguage('go', require('highlight.js/lib/languages/go'));
hljs.registerLanguage('groovy', require('highlight.js/lib/languages/groovy'));
hljs.registerLanguage('handlebars', require('highlight.js/lib/languages/handlebars'));
hljs.registerLanguage('haskell', require('highlight.js/lib/languages/haskell'));
hljs.registerLanguage('htmlbars', require('highlight.js/lib/languages/htmlbars'));
hljs.registerLanguage('http', require('highlight.js/lib/languages/http'));
hljs.registerLanguage('ini', require('highlight.js/lib/languages/ini'));
hljs.registerLanguage('java', require('highlight.js/lib/languages/java'));
@ -69,7 +67,6 @@ hljs.registerLanguage('scala', require('highlight.js/lib/languages/scala'));
hljs.registerLanguage('scheme', require('highlight.js/lib/languages/scheme'));
hljs.registerLanguage('scss', require('highlight.js/lib/languages/scss'));
hljs.registerLanguage('shell', require('highlight.js/lib/languages/shell'));
hljs.registerLanguage('sql_more', require('highlight.js/lib/languages/sql_more'));
hljs.registerLanguage('sql', require('highlight.js/lib/languages/sql'));
hljs.registerLanguage('stan', require('highlight.js/lib/languages/stan'));
hljs.registerLanguage('swift', require('highlight.js/lib/languages/swift'));

Просмотреть файл

@ -5,7 +5,7 @@
"no-duplicate-variable": true,
"indent": [true, "spaces"],
"quotemark": [true, "single"],
"max-line-length": [true, 80],
"max-line-length": [true, 120],
"prefer-const": true,
"no-console": ["log", {"allow": ["warn", "error"]}]
}