From 3c1beb91b79472fa1067eb00c7559b025178c914 Mon Sep 17 00:00:00 2001 From: Chang-Hung Liang Date: Fri, 13 Dec 2024 12:40:33 +0800 Subject: [PATCH] Fix command help formatting --- packages/cli/src/oclif/hooks/renderMarkdownHelp.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/oclif/hooks/renderMarkdownHelp.js b/packages/cli/src/oclif/hooks/renderMarkdownHelp.js index 24304f964..605ffa7ef 100644 --- a/packages/cli/src/oclif/hooks/renderMarkdownHelp.js +++ b/packages/cli/src/oclif/hooks/renderMarkdownHelp.js @@ -1,22 +1,22 @@ const chalk = require('chalk'); const { marked } = require('marked'); -const TerminalRenderer = require('marked-terminal'); +const { markedTerminal } = require('marked-terminal'); -marked.setOptions({ - renderer: new TerminalRenderer({ +marked.use( + markedTerminal({ tab: 2, width: process.stdout.getWindowSize()[0] - 2, reflowText: true, codespan: chalk.underline.bold, }), -}); +); module.exports = (options) => { const cmdId = options.id === 'help' ? options.argv[0] : options.id; const cmd = options.config.findCommand(cmdId); if (cmd) { if (cmd.description) { - cmd.description = marked(cmd.description).trim(); + cmd.description = marked.parse(cmd.description).trim(); } // TODO: Do the same for flag descriptions? }