@atikk-co-jp/notion-mcp-server 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -0
- package/README.md +1 -0
- package/dist/src/converters/__tests__/markdown-to-blocks.test.js +28 -0
- package/dist/src/converters/markdown-to-blocks.d.ts.map +1 -1
- package/dist/src/converters/markdown-to-blocks.js +9 -0
- package/dist/src/schemas/descriptions/fields.js +2 -2
- package/dist/src/tools/__tests__/context-size.test.js +1 -1
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -228,6 +228,7 @@ Markdownを使ってページを作成します。`create-page`と比較して**
|
|
|
228
228
|
- ブックマーク: `[bookmark](url)` または `[bookmark:キャプション](url)`
|
|
229
229
|
- カラム: `:::columns` / `:::column` / `:::`
|
|
230
230
|
- メディア: `@[embed](url)`, `@[video](url)`, `@[audio](url)`, `@[file](url)`, `@[pdf](url)`
|
|
231
|
+
- 目次: `[TOC]`
|
|
231
232
|
|
|
232
233
|
**子ページを作成:**
|
|
233
234
|
```json
|
package/README.md
CHANGED
|
@@ -227,6 +227,7 @@ Supports two parent types:
|
|
|
227
227
|
- Bookmark: `[bookmark](url)` or `[bookmark:caption](url)`
|
|
228
228
|
- Columns: `:::columns` / `:::column` / `:::`
|
|
229
229
|
- Media: `@[embed](url)`, `@[video](url)`, `@[audio](url)`, `@[file](url)`, `@[pdf](url)`
|
|
230
|
+
- Table of contents: `[TOC]`
|
|
230
231
|
|
|
231
232
|
**Create a child page:**
|
|
232
233
|
```json
|
|
@@ -791,4 +791,32 @@ const x = 1
|
|
|
791
791
|
expect(result[3].type).toBe('paragraph');
|
|
792
792
|
});
|
|
793
793
|
});
|
|
794
|
+
describe('table_of_contents', () => {
|
|
795
|
+
it('converts [TOC] to table_of_contents', () => {
|
|
796
|
+
const blocks = markdownToBlocks('[TOC]');
|
|
797
|
+
expect(blocks).toHaveLength(1);
|
|
798
|
+
expect(blocks[0].type).toBe('table_of_contents');
|
|
799
|
+
expect(getBlockProp(blocks[0], 'table_of_contents')).toEqual({ color: 'default' });
|
|
800
|
+
});
|
|
801
|
+
it('converts [toc] (lowercase) to table_of_contents', () => {
|
|
802
|
+
const blocks = markdownToBlocks('[toc]');
|
|
803
|
+
expect(blocks).toHaveLength(1);
|
|
804
|
+
expect(blocks[0].type).toBe('table_of_contents');
|
|
805
|
+
});
|
|
806
|
+
it('converts [Toc] (mixed case) to table_of_contents', () => {
|
|
807
|
+
const blocks = markdownToBlocks('[Toc]');
|
|
808
|
+
expect(blocks).toHaveLength(1);
|
|
809
|
+
expect(blocks[0].type).toBe('table_of_contents');
|
|
810
|
+
});
|
|
811
|
+
it('handles [TOC] with surrounding whitespace', () => {
|
|
812
|
+
const blocks = markdownToBlocks(' [TOC] ');
|
|
813
|
+
expect(blocks).toHaveLength(1);
|
|
814
|
+
expect(blocks[0].type).toBe('table_of_contents');
|
|
815
|
+
});
|
|
816
|
+
it('does not convert [TOC] inside text', () => {
|
|
817
|
+
const blocks = markdownToBlocks('See [TOC] for details');
|
|
818
|
+
expect(blocks).toHaveLength(1);
|
|
819
|
+
expect(blocks[0].type).toBe('paragraph');
|
|
820
|
+
});
|
|
821
|
+
});
|
|
794
822
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-to-blocks.d.ts","sourceRoot":"","sources":["../../../src/converters/markdown-to-blocks.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAO7D;;GAEG;AACH,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAA;QACf,IAAI,CAAC,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAA;KAC9B,CAAA;IACD,WAAW,CAAC,EAAE;QACZ,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,aAAa,CAAC,EAAE,OAAO,CAAA;QACvB,SAAS,CAAC,EAAE,OAAO,CAAA;QACnB,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE,CA6JnE;AAmBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"markdown-to-blocks.d.ts","sourceRoot":"","sources":["../../../src/converters/markdown-to-blocks.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAO7D;;GAEG;AACH,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAA;QACf,IAAI,CAAC,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAA;KAC9B,CAAA;IACD,WAAW,CAAC,EAAE;QACZ,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,aAAa,CAAC,EAAE,OAAO,CAAA;QACvB,SAAS,CAAC,EAAE,OAAO,CAAA;QACnB,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE,CA6JnE;AAmBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,EAAE,CA+cvE"}
|
|
@@ -232,6 +232,15 @@ export function markdownToBlocks(markdown) {
|
|
|
232
232
|
i++;
|
|
233
233
|
continue;
|
|
234
234
|
}
|
|
235
|
+
// 目次: [TOC] (case-insensitive)
|
|
236
|
+
if (/^\[toc\]$/i.test(line.trim())) {
|
|
237
|
+
blocks.push({
|
|
238
|
+
type: 'table_of_contents',
|
|
239
|
+
table_of_contents: { color: 'default' },
|
|
240
|
+
});
|
|
241
|
+
i++;
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
235
244
|
// 見出し: # ## ### (####以上はheading_3にフォールバック)
|
|
236
245
|
const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
|
|
237
246
|
if (headingMatch) {
|
|
@@ -84,9 +84,9 @@ export const Fields = {
|
|
|
84
84
|
desc: {
|
|
85
85
|
default: 'Markdown: # headings, - lists, - [ ] checkboxes, ``` code, > quotes, | tables |, ![]() images, **bold**, *italic*, ~~strike~~, `code`, [links](). ' +
|
|
86
86
|
'Extended: <details><summary> toggle, > [!NOTE/WARNING/TIP/IMPORTANT/CAUTION] callout, $$ equation, <u>/++ underline, {color:x}{/color}, {bg:x}{/bg}, ' +
|
|
87
|
-
'[bookmark](), :::columns, @[embed/video/audio/file/pdf]().',
|
|
87
|
+
'[bookmark](), :::columns, @[embed/video/audio/file/pdf](), [TOC] table of contents.',
|
|
88
88
|
short: '# headings, - lists, - [ ] checkboxes, ``` code, > quotes, | tables |, **bold**, *italic*, [links](), ' +
|
|
89
|
-
'<details> toggle, > [!NOTE] callout, $$ equation.',
|
|
89
|
+
'<details> toggle, > [!NOTE] callout, $$ equation, [TOC] table of contents.',
|
|
90
90
|
},
|
|
91
91
|
},
|
|
92
92
|
// ============================================
|
|
@@ -133,7 +133,7 @@ describe('Tool context size', () => {
|
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
135
|
describe('Description length checks', () => {
|
|
136
|
-
const MAX_DESCRIPTION_LENGTH =
|
|
136
|
+
const MAX_DESCRIPTION_LENGTH = 600;
|
|
137
137
|
it.each(toolNames)('%s description should be concise', (toolName) => {
|
|
138
138
|
const tool = registeredTools[toolName];
|
|
139
139
|
const descLength = tool.description?.length ?? 0;
|