Skip to content

Commit 4f518a6

Browse files
committed
Support @include in readme file
Ref: #2814
1 parent 8244925 commit 4f518a6

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ title: Changelog
44

55
## Unreleased
66

7+
### Bug Fixes
8+
9+
- `@include` and `@includeCode` now work in the readme file, #2814.
10+
711
## v0.27.5 (2024-12-14)
812

913
### Bug Fixes

src/lib/converter/converter.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ export class Converter extends AbstractComponent<Application, ConverterEvents> {
248248
*/
249249
static readonly EVENT_RESOLVE_END = ConverterEvents.RESOLVE_END;
250250

251+
/** @internal @hidden */
252+
includePlugin: IncludePlugin;
253+
251254
constructor(owner: Application) {
252255
super(owner);
253256

@@ -304,7 +307,7 @@ export class Converter extends AbstractComponent<Application, ConverterEvents> {
304307
new PackagePlugin(this);
305308
new SourcePlugin(this);
306309
new TypePlugin(this);
307-
new IncludePlugin(this);
310+
this.includePlugin = new IncludePlugin(this);
308311
new MergeModuleWithPlugin(this);
309312
}
310313

src/lib/converter/plugins/IncludePlugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class IncludePlugin extends ConverterComponent {
4646
}
4747
}
4848

49-
private checkIncludeTagsParts(
49+
checkIncludeTagsParts(
5050
refl: Reflection,
5151
relative: string,
5252
parts: CommentDisplayPart[],

src/lib/converter/plugins/PackagePlugin.ts

+8
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ export class PackagePlugin extends ConverterComponent {
135135
);
136136

137137
project.readme = content;
138+
139+
// This isn't ideal, but seems better than figuring out the readme
140+
// path over in the include plugin...
141+
this.owner.includePlugin.checkIncludeTagsParts(
142+
project,
143+
Path.dirname(this.readmeFile),
144+
content,
145+
);
138146
}
139147

140148
if (this.packageJson) {

0 commit comments

Comments
 (0)