Skip to content

Commit

Permalink
feat: add included option
Browse files Browse the repository at this point in the history
  • Loading branch information
makamekm committed Sep 13, 2024
1 parent 9ad49e8 commit 7c090ff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@diplodoc/mermaid-extension": "^1.2.1",
"@diplodoc/openapi-extension": "^2.3.1",
"@diplodoc/prettier-config": "^2.0.0",
"@diplodoc/transform": "^4.30.2",
"@diplodoc/transform": "^4.31.0",
"@diplodoc/tsconfig": "^1.0.2",
"@octokit/core": "4.2.4",
"@types/async": "^3.2.15",
Expand Down
2 changes: 2 additions & 0 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ interface YfmConfig {
strict: boolean;
ignoreStage: string;
singlePage: boolean;
included: boolean;
removeHiddenTocItems: boolean;
vcs?: VCSConfiguration;
connector?: VCSConnectorConfig;
Expand Down Expand Up @@ -248,6 +249,7 @@ export interface PluginOptions {
collectOfPlugins?: (input: string, options: PluginOptions) => string;
changelogs?: ChangelogItem[];
extractChangelogs?: boolean;
included?: boolean;
}

export interface Plugin {
Expand Down
6 changes: 4 additions & 2 deletions src/resolvers/md2md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {enrichWithFrontMatter} from '../services/metadata';

export async function resolveMd2Md(options: ResolveMd2MdOptions): Promise<void> {
const {inputPath, outputPath, metadata: metadataOptions} = options;
const {input, output, changelogs: changelogsSetting} = ArgvService.getConfig();
const {input, output, changelogs: changelogsSetting, included} = ArgvService.getConfig();
const resolvedInputPath = resolve(input, inputPath);

const vars = getVarsPerFile(inputPath);
Expand All @@ -36,6 +36,7 @@ export async function resolveMd2Md(options: ResolveMd2MdOptions): Promise<void>
vars: vars,
log,
copyFile,
included,
});

writeFileSync(outputPath, result);
Expand Down Expand Up @@ -83,7 +84,6 @@ function copyFile(targetPath: string, targetDestPath: string, options?: PluginOp
if (options) {
const sourceIncludeContent = readFileSync(targetPath, 'utf8');
const {result} = transformMd2Md(sourceIncludeContent, options);

writeFileSync(targetDestPath, result);
} else {
shell.cp(targetPath, targetDestPath);
Expand Down Expand Up @@ -113,6 +113,7 @@ function transformMd2Md(input: string, options: PluginOptions) {
collectOfPlugins,
log: pluginLog,
copyFile: pluginCopyFile,
included,
} = options;

let output = input;
Expand All @@ -136,6 +137,7 @@ function transformMd2Md(input: string, options: PluginOptions) {
collectOfPlugins,
changelogs,
extractChangelogs: Boolean(changelogsSetting),
included,
});
}

Expand Down

0 comments on commit 7c090ff

Please sign in to comment.