Skip to content

Commit

Permalink
Merge branch 'master' into fix/118674-the-same-level-template-page-is…
Browse files Browse the repository at this point in the history
…-being-applied-to-lower-level-pages-unintentionally
  • Loading branch information
miya authored Mar 27, 2023
2 parents d71f432 + 7552187 commit 4f70a9f
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 1,572 deletions.
1 change: 1 addition & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"remark-emoji": "^3.0.2",
"remark-gfm": "^3.0.1",
"remark-math": "^5.1.1",
"remark-toc": "^8.0.1",
"remark-wiki-link": "^1.0.4",
"socket.io": "^4.2.0",
"stream-to-promise": "^3.0.0",
Expand Down
13 changes: 5 additions & 8 deletions packages/app/resource/locales/en_US/sandbox.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<div class="card">
<div class="card-body">
# :memo: Table of Contents

# Table of Contents
Add `ToC` after some `#` signs.
`Table of Contents` or `Table-of-Contents` is also OK.

```
@[toc]
# ToC
```

@[toc]

</div>
</div>
## ToC

# :memo: Block Elements

Expand Down
13 changes: 5 additions & 8 deletions packages/app/resource/locales/ja_JP/sandbox.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<div class="card">
<div class="card-body">
# :memo: 目次

# 目次
いくつかの `#` 記号に続けて `ToC` という文字列を記述します。
`Table of Contents` または `Table-of-Contents` でも構いません。

```
@[toc]
# ToC
```

@[toc]

</div>
</div>
## ToC

# :memo: Block Elements

Expand Down
13 changes: 5 additions & 8 deletions packages/app/resource/locales/zh_CN/sandbox.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<div class="card">
<div class="card-body">
# :memo: Table of Contents

# Table of Contents
Add `ToC` after some `#` signs.
`Table of Contents` or `Table-of-Contents` is also OK.

```
@[toc]
# ToC
```

@[toc]

</div>
</div>
## ToC

# :memo: Block Elements

Expand Down
9 changes: 5 additions & 4 deletions packages/app/src/services/renderer/renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import breaks from 'remark-breaks';
import emoji from 'remark-emoji';
import gfm from 'remark-gfm';
import math from 'remark-math';
import toc from 'remark-toc';
import deepmerge from 'ts-deepmerge';
import type { PluggableList, Pluggable, PluginTuple } from 'unified';

Expand All @@ -38,10 +39,9 @@ import * as addLineNumberAttribute from './rehype-plugins/add-line-number-attrib
import * as keywordHighlighter from './rehype-plugins/keyword-highlighter';
import { relativeLinks } from './rehype-plugins/relative-links';
import { relativeLinksByPukiwikiLikeLinker } from './rehype-plugins/relative-links-by-pukiwiki-like-linker';
import * as toc from './rehype-plugins/relocate-toc';
import * as relocateToc from './rehype-plugins/relocate-toc';
import * as plantuml from './remark-plugins/plantuml';
import { pukiwikiLikeLinker } from './remark-plugins/pukiwiki-like-linker';
import * as table from './remark-plugins/table';
import * as xsvToTable from './remark-plugins/xsv-to-table';

// import EasyGrid from './PreProcessor/EasyGrid';
Expand Down Expand Up @@ -124,6 +124,7 @@ const verifySanitizePlugin = (options: RendererOptions, shouldBeTheLastItem = tr
const generateCommonOptions = (pagePath: string|undefined): RendererOptions => {
return {
remarkPlugins: [
[toc, { maxDepth: 3, tight: true, prefix: 'mdcont-' }],
gfm,
emoji,
pukiwikiLikeLinker,
Expand Down Expand Up @@ -188,7 +189,7 @@ export const generateViewOptions = (
[lsxGrowiPlugin.rehypePlugin, { pagePath, isSharedPage: config.isSharedPage }],
rehypeSanitizePlugin,
katex,
[toc.rehypePluginStore, { storeTocNode }],
[relocateToc.rehypePluginStore, { storeTocNode }],
);

// add components
Expand Down Expand Up @@ -232,7 +233,7 @@ export const generateTocOptions = (config: RendererConfig, tocNode: HtmlElementN

// add rehype plugins
rehypePlugins.push(
[toc.rehypePluginRestore, { tocNode }],
[relocateToc.rehypePluginRestore, { tocNode }],
rehypeSanitizePlugin,
);

Expand Down
3 changes: 0 additions & 3 deletions packages/remark-growi-directive/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
"is-hidden": "^2.0.0",
"mdast-util-from-markdown": "^1.0.0",
"micromark": "^3.0.0",
"micromark-build": "^1.0.0",
"remark": "^14.0.0",
"remark-cli": "^10.0.0",
"remark-preset-wooorm": "^9.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"to-vfile": "^7.0.0",
Expand Down
Loading

0 comments on commit 4f70a9f

Please sign in to comment.