Skip to content
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
7 changes: 7 additions & 0 deletions documentation/docmaker.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
"cyJson": "#core/initialisation"
},

"mdRunButtonBlocked": [
"intro.md",
"notation.md",
"getting-started.md",
"core/init.md"
],

"sections": [
{
"md": "links"
Expand Down
21 changes: 15 additions & 6 deletions documentation/docmaker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const readFileSync = file => fs.readFileSync( path.join(__dirname, file), 'utf8'

let config, versions;
let mdRend = new marked.Renderer();
let mdRendDefault = new marked.Renderer();

let rendCode = mdRend.code;
mdRend.code = function(code, lang){
Expand Down Expand Up @@ -69,9 +70,7 @@ function md2html( file ){
throw 'A markdown file named `' + file + '` was referenced but could not be read';
}

// let html = converter.makeHtml( md );
//let html = mdConvertor( md );
marked.setOptions({
let options = {
highlight: function(code, lang){
let ret;

Expand All @@ -87,10 +86,20 @@ function md2html( file ){

smartypants: true,

renderer: mdRend,

gfm: true
} );
};

let mdBtnBlocked = config.mdRunButtonBlocked.indexOf(file) >= 0;
let mdBtnAllowed = !mdBtnBlocked;

if( mdBtnAllowed ){
Comment on lines +93 to +95
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 'mdBtnAllowed' is redundant since it's just the negation of 'mdBtnBlocked'. Consider using '!mdBtnBlocked' directly in the conditional check to reduce unnecessary variables.

Suggested change
let mdBtnAllowed = !mdBtnBlocked;
if( mdBtnAllowed ){
if( !mdBtnBlocked ){

Copilot uses AI. Check for mistakes.
// add run button to code blocks
options.renderer = mdRend;
} else {
options.renderer = mdRendDefault;
}

marked.setOptions(options);

let html = marked.parse( md );

Expand Down
Loading