Skip to content

Commit 398c5a1

Browse files
committed
Reviewd book.module
1 parent 39788e2 commit 398c5a1

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
"private": true,
1717
"dependencies": {
18+
"@akebifiky/remark-simple-plantuml": "^1.0.2",
1819
"@angular/animations": "^11.0.5",
1920
"@angular/cdk": "^11.0.3",
2021
"@angular/common": "^10.2.4",

src/app/book/markdown/markdown.service.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export const MARKDOWN_CONFIG_TOKEN = new InjectionToken<any>( 'forRoot() configu
5050
providedIn: 'root'
5151
})
5252
export class MarkdownService {
53+
remarkPlugins: unified.PluggableList;
54+
5355
// Lazy init processor
5456
@lazyInitialize
5557
get processor(): unified.Processor {
@@ -124,13 +126,6 @@ export class MarkdownService {
124126
.use(sectionPlugin);
125127
}
126128

127-
get remarkPlugins(): unified.PluggableList {
128-
if (Array.isArray(this.config)) {
129-
return this.config;
130-
}
131-
return this.config.plugins;
132-
}
133-
134129
get bookPath () {
135130
return this.settings.bookPath;
136131
}
@@ -145,7 +140,7 @@ export class MarkdownService {
145140
@Optional() @Inject(MARKDOWN_CONFIG_TOKEN) private config: Preset
146141
) {
147142
this.config = this.config || { plugins: [] };
148-
this.config.plugins = this.config.plugins || [];
143+
this.remarkPlugins = this.config.plugins;
149144
}
150145

151146
linkPlugin = () => {

src/app/gbr-preset/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import headings from '@rigor789/remark-autolink-headings';
22
import frontmatter from 'remark-frontmatter';
3+
import simplePlantUML from '@akebifiky/remark-simple-plantuml';
34
import gfm from 'remark-gfm';
45
import math from 'remark-math';
56
import katex from 'remark-html-katex';
@@ -52,6 +53,7 @@ export const plugins = [
5253
math,
5354
katex,
5455
gemojiToEmoji,
56+
simplePlantUML,
5557
infoStringToAttr,
5658
mermaid,
5759
prism

0 commit comments

Comments
 (0)