build(docs-infra): never show linenums for triple-backticked code blocks (#31493)

PR Close #31493
This commit is contained in:
Pete Bacon Darwin 2019-07-10 21:19:58 +01:00 committed by Matias Niemelä
parent d5d8657d30
commit 46c03bd866
2 changed files with 4 additions and 2 deletions

View File

@ -4,7 +4,9 @@
module.exports = function code(h, node) { module.exports = function code(h, node) {
var value = node.value ? ('\n' + node.value + '\n') : ''; var value = node.value ? ('\n' + node.value + '\n') : '';
var lang = node.lang && node.lang.match(/^[^ \t]+(?=[ \t]|$)/); var lang = node.lang && node.lang.match(/^[^ \t]+(?=[ \t]|$)/);
var props = {}; var props = {
linenums: 'false'
};
if (lang) { if (lang) {
props.language = lang; props.language = lang;

View File

@ -88,7 +88,7 @@ describe('remark: renderMarkdown service', () => {
'```'; '```';
const output = renderMarkdown(content); const output = renderMarkdown(content);
expect(output).toEqual( expect(output).toEqual(
'<code-example language="ts">\n' + '<code-example linenums="false" language="ts">\n' +
' class MyClass {\n' + ' class MyClass {\n' +
' method1() { ... }\n' + ' method1() { ... }\n' +
' }\n' + ' }\n' +