Skip to content

Commit

Permalink
Support @include in readme file
Browse files Browse the repository at this point in the history
Ref: #2814
  • Loading branch information
Gerrit0 committed Dec 18, 2024
1 parent 8244925 commit 4f518a6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ title: Changelog

## Unreleased

### Bug Fixes

- `@include` and `@includeCode` now work in the readme file, #2814.

## v0.27.5 (2024-12-14)

### Bug Fixes
Expand Down
5 changes: 4 additions & 1 deletion src/lib/converter/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ export class Converter extends AbstractComponent<Application, ConverterEvents> {
*/
static readonly EVENT_RESOLVE_END = ConverterEvents.RESOLVE_END;

/** @internal @hidden */
includePlugin: IncludePlugin;

constructor(owner: Application) {
super(owner);

Expand Down Expand Up @@ -304,7 +307,7 @@ export class Converter extends AbstractComponent<Application, ConverterEvents> {
new PackagePlugin(this);
new SourcePlugin(this);
new TypePlugin(this);
new IncludePlugin(this);
this.includePlugin = new IncludePlugin(this);
new MergeModuleWithPlugin(this);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/converter/plugins/IncludePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class IncludePlugin extends ConverterComponent {
}
}

private checkIncludeTagsParts(
checkIncludeTagsParts(
refl: Reflection,
relative: string,
parts: CommentDisplayPart[],
Expand Down
8 changes: 8 additions & 0 deletions src/lib/converter/plugins/PackagePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ export class PackagePlugin extends ConverterComponent {
);

project.readme = content;

// This isn't ideal, but seems better than figuring out the readme
// path over in the include plugin...
this.owner.includePlugin.checkIncludeTagsParts(
project,
Path.dirname(this.readmeFile),
content,
);
}

if (this.packageJson) {
Expand Down

0 comments on commit 4f518a6

Please sign in to comment.