Skip to content

Commit

Permalink
feat: enhance the 'site' params in config.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Dec 17, 2024
1 parent 05fb69a commit 70db588
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/document/docs/introduce/api/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ site: iDoc

```yml
site: iDoc {{version}}
site: iDoc {{version:v1.2.3}}
```

可以使用 `idoc --site "iDoc {{version}}"` 命令参数配置网站名称,他们的权重 `idoc.yml` -> `package.json` -> `idoc -s`
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/utils/conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ export class Conf {
if (data) {
this.initScope();
}
this.data.site = this.data.site?.replace('{{version}}', `<sup>${this.data.version}</sup>`);
this.data.site = this.data.site
?.replace('{{version}}', `<sup>${this.data.version}</sup>`)
.replace(/{{version:(.*?)}}/g, `<sup>$1</sup>`);

await cacheFile.init(this.data.cacheFileStat);
await cacheFile.load();
Expand Down

0 comments on commit 70db588

Please sign in to comment.