Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDE-4089 fix(cli): fix command help markdown formatting #930

Merged
merged 1 commit into from
Dec 13, 2024
Merged
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
10 changes: 5 additions & 5 deletions packages/cli/src/oclif/hooks/renderMarkdownHelp.js
Original file line number Diff line number Diff line change
@@ -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?
}
Expand Down
Loading