์ง๋ ฌํ
๊ธฐ๋ณธ ์ง๋ ฌํ ์ ํธ๋ฆฌํฐ๋ @inkio/editor์ @inkio/simple์์ ๋ค์ exportํฉ๋๋ค.
import { toPlainText, toSummary, getContentStats } from '@inkio/editor';
import { extractMentions, extractHashtags } from '@inkio/advanced';@inkio/core ์ ํธ๋ฆฌํฐ
@inkio/editor์ @inkio/simple์์ ๋ค์ exportํ๋ฉฐ, ๋ชจ๋ JSONContent๋ฅผ ์
๋ ฅ์ผ๋ก ๋ฐ์ต๋๋ค.
| ํจ์ | ์๊ทธ๋์ฒ | ์ค๋ช |
|---|---|---|
toPlainText | (content) => string | ๋ชจ๋ ํ ์คํธ๋ฅผ ์ถ์ถํด ํ๋์ ์ผ๋ฐ ํ ์คํธ ๋ฌธ์์ด๋ก ๋ฐํํฉ๋๋ค. ์ฐ์ ๊ณต๋ฐฑ/์ค๋ฐ๊ฟ์ ์ ๋ฆฌ๋๊ณ ์๋ค ๊ณต๋ฐฑ์ ์ ๊ฑฐ๋ฉ๋๋ค. |
toSummary | (content, maxLength = 140) => string | toPlainText ๊ฒฐ๊ณผ๋ฅผ maxLength๊น์ง ์๋ผ๋ธ ์์ฝ์ ๋ฐํํฉ๋๋ค. ๊ธธ์ด๋ฅผ ์ด๊ณผํ๋ฉด ๋์ ...์ด ๋ถ์ต๋๋ค. |
getContentStats | (content) => { words: number; chars: number; blocks: number } | ๋จ์ด ์, ๋ฌธ์ ์, ๋ธ๋ก ์๋ฅผ ๋ด์ ๊ฐ์ฒด๋ฅผ ๋ฐํํฉ๋๋ค. words/chars๋ ์ผ๋ฐ ํ
์คํธ ๊ธฐ์ค์
๋๋ค. |
const summary = toSummary(content, 80);
const { words, chars, blocks } = getContentStats(content);@inkio/advanced ์ ํธ๋ฆฌํฐ
| ํจ์ | ์๊ทธ๋์ฒ | ์ค๋ช |
|---|---|---|
extractMentions | (content) => Array<{ id: string; label: string }> | ๋ฌธ์์ ํฌํจ๋ ๋ฉ์
๋
ธ๋๋ฅผ ์ถ์ถํฉ๋๋ค. id/label ์กฐํฉ์ด ๊ฐ์ ํญ๋ชฉ์ ์ค๋ณต ์ ๊ฑฐ๋ฉ๋๋ค. |
extractHashtags | (content) => string[] | ๋ฌธ์์ ํฌํจ๋ ํด์ํ๊ทธ ๋ผ๋ฒจ์ ์ถ์ถํฉ๋๋ค. ์ ํ #๋ ์ ๊ฑฐ๋๋ฉฐ ์ค๋ณต๋ ์ ๊ฑฐ๋ฉ๋๋ค. |
const mentions = extractMentions(content); // [{ id: 'u1', label: 'Alice' }]
const tags = extractHashtags(content); // ['inkio', 'editor']Markdown import/export๋ ๋ณ๋ subpath๋ก ์ ๊ณตํฉ๋๋ค.
import { parseMarkdown, stringifyMarkdown } from '@inkio/editor/markdown';Markdown round-trip์ core ๋ฒ์๊น์ง๋ง ๋ณด์ฅํฉ๋๋ค.
๊ตฌํ์ remark/unified ๊ธฐ๋ฐ์ด๋ฉฐ HTML bridge๋ฅผ ์ฌ์ฉํ์ง ์์ต๋๋ค.
Last updated on