Describe the feature
Add a --compile flag to the jsii-rosetta markdown command that enables TypeScript compilation and type checking for code snippets, similar to the existing extract command.
Use Case
The markdown command currently only does syntactic translation without type checking. This results in:
- Less accurate translations due to missing type information
- Undetected errors in documentation examples
- Inconsistent behavior compared to the
extract command which supports --compile
For projects like AWS CDK generating polyglot documentation, compilation would improve translation accuracy and catch errors in examples.
Proposed Solution
Add --compile and --fail flags to the markdown command, reusing the existing Translator class infrastructure:
# Enable compilation
npx jsii-rosetta markdown README.md --language python --compile
# Fail on compilation errors
npx jsii-rosetta markdown README.md --language python --compile --fail
Implementation would modify src/main.ts to add the CLI options and update src/commands/convert.ts to use the full Translator class instead of direct SnippetTranslator.
Other Information
- Backwards compatible (compilation is opt-in)
- Reuses existing compilation infrastructure
- Aligns behavior with other jsii-rosetta commands
- Improves documentation quality through type checking
Acknowledgements
CDK version used
N/A (jsii-rosetta feature)
Environment details
macOS, Node.js, TypeScript
Describe the feature
Add a
--compileflag to thejsii-rosetta markdowncommand that enables TypeScript compilation and type checking for code snippets, similar to the existingextractcommand.Use Case
The
markdowncommand currently only does syntactic translation without type checking. This results in:extractcommand which supports--compileFor projects like AWS CDK generating polyglot documentation, compilation would improve translation accuracy and catch errors in examples.
Proposed Solution
Add
--compileand--failflags to the markdown command, reusing the existingTranslatorclass infrastructure:Implementation would modify
src/main.tsto add the CLI options and updatesrc/commands/convert.tsto use the fullTranslatorclass instead of directSnippetTranslator.Other Information
Acknowledgements
CDK version used
N/A (jsii-rosetta feature)
Environment details
macOS, Node.js, TypeScript