build(docs-infra): never show linenums for triple-backticked code blocks (#31493)
PR Close #31493
This commit is contained in:
parent
d5d8657d30
commit
46c03bd866
|
@ -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;
|
||||||
|
|
|
@ -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' +
|
||||||
|
|
Loading…
Reference in New Issue