Skip to content

Add feature to generate Markdown files#1087

Open
jshackell-sfdc wants to merge 19 commits into
mainfrom
js/markdown
Open

Add feature to generate Markdown files#1087
jshackell-sfdc wants to merge 19 commits into
mainfrom
js/markdown

Conversation

@jshackell-sfdc
Copy link
Copy Markdown
Contributor

No description provided.

@jshackell-sfdc jshackell-sfdc requested a review from a team as a code owner May 6, 2026 23:48
The markdown.test.ts file expects generated markdown files in test/tmp-md,
but the test:only task only depended on test:command-reference (which generates
DITA XML). Added test:command-reference-markdown as an additional dependency
to ensure markdown test files are generated before tests run.
Added tests to verify:
- HTML entity escaping in descriptions
- Consistent whitespace normalization
- Removal of leading $ from shell examples
- Proper markdown table formatting with pipe escaping
- State label handling for beta/preview/pilot commands

These tests ensure the markdown generator produces consistent, properly
formatted output for all command documentation.
HTML comments like <!-- prettier-ignore-start --> are intentional markdown
and should not be flagged by the entity escaping test.
@@ -146,9 +151,13 @@ export default class CommandReferenceGenerate extends SfCommand<CommandReference
const commands = await this.loadCommands(plugins);
const topicMetadata = this.loadTopicMetadata(commands);
const cliMeta = this.loadCliMeta();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggest to add validation for output-format flag before docs:

 const outputFormat = flags['output-format'];
  if (outputFormat !== 'dita' && outputFormat !== 'markdown') {
    throw new SfError(`Invalid output format: ${outputFormat}. Must be 'dita' or 'markdown'.`);
  } 

const docs = new Docs(Ditamap.outputDir, flags.hidden, topicMetadata, cliMeta);
const docs = new Docs(
Ditamap.outputDir,
flags['output-format'] as 'dita' | 'markdown',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

change this to outputFormat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants