diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index 6d7385c..0698c09 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -34,4 +34,4 @@ jobs: - name: Show report if: always() - run: cat temp/mfc-js.api.md + run: cat temp/mfm-js.api.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e720648..5c4f071 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,7 +66,7 @@ PRを作る際は、`pnpm run api`コマンドを実行してAPIレポートを ### Codecov このプロジェクトではカバレッジの計測に[Codecov](https://about.codecov.io/)を導入しています。カバレッジは、コードがどれくらいテストでカバーされているかを表すものです。 -カバレッジ計測はCIで自動的に行われ、特に操作は必要ありません。カバレッジは[ここ](https://codecov.io/gh/kokonect-link/mfc.js)から見ることができます。 +カバレッジ計測はCIで自動的に行われ、特に操作は必要ありません。カバレッジは[ここ](https://codecov.io/gh/cheripia-dev/mfm.js)から見ることができます。 また、各PRに対してもそのブランチのカバレッジが自動的に計算され、マージ先のカバレッジとの差分を含んだレポートがCodecovのbotによりコメントされます。これにより、そのPRをマージすることでどれくらいカバレッジが増加するのか/減少するのかを確認することができます。 diff --git a/README.md b/README.md index 6532fa9..077d315 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ -# mfc.js -An MFC parser implementation with TypeScript. -[Try it out!](https://runkit.com/npm/mfc-js) +# mfm.js +An MFM parser implementation with TypeScript. -[![Test](https://github.com/kokonect-link/mfc.js/actions/workflows/test.yml/badge.svg)](https://github.com/kokonect-link/mfc.js/actions/workflows/test.yml) -[![codecov](https://codecov.io/gh/kokonect-link/mfc.js/branch/develop/graph/badge.svg?token=irAWFiHK8T)](https://codecov.io/gh/kokonect-link/mfc.js) +[![Test](https://github.com/cheripia-dev/mfm.js/actions/workflows/test.yml/badge.svg)](https://github.com/cheripia-dev/mfm.js/actions/workflows/test.yml) -[![NPM](https://nodei.co/npm/mfc-js.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/mfc-js) +This is the Cheripia fork of [misskey-dev/mfm.js](https://github.com/misskey-dev/mfm.js). +The package name is `mfm-js`, but installing `mfm-js` from npm does not install this fork. ## Installation -``` -npm i mfc-js +Install this fork from GitHub, replacing `` with the full commit SHA to pin: + +```sh +npm install 'mfm-js@git+https://github.com/cheripia-dev/mfm.js.git#' ``` ## Usage @@ -17,7 +18,7 @@ Please see [docs](./docs/index.md) for the detail. TypeScript: ```ts -import * as mfc from 'mfc-js'; +import * as mfm from 'mfm-js'; const inputText = `
@@ -28,13 +29,13 @@ I'm @ai, A bot of cherrypick! https://github.com/syuilo/ai
`; -// Generate a MFC tree from the full MFC text. +// Generate an MFM tree from the full MFM text. const mfmTree = mfm.parse(inputText); -// Generate a MFC tree from the simple MFC text. +// Generate an MFM tree from the simple MFM text. const simpleMfmTree = mfm.parseSimple('I like the hot soup :soup:​'); -// Reverse to a MFC text from the MFC tree. +// Reverse to an MFM text from the MFM tree. const text = mfm.toString(mfmTree); ``` @@ -42,7 +43,7 @@ const text = mfm.toString(mfmTree); ## Develop ### 1. Clone ``` -git clone https://github.com/kokonect-link/mfc.js.git +git clone https://github.com/cheripia-dev/mfm.js.git ``` ### 2. Install packages diff --git a/etc/mfc-js.api.md b/etc/mfc-js.api.md deleted file mode 100644 index 4a4c344..0000000 --- a/etc/mfc-js.api.md +++ /dev/null @@ -1,284 +0,0 @@ -## API Report File for "mfc-js" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -// @public (undocumented) -export const BOLD: (children: MfmInline[]) => NodeType<'bold'>; - -// @public (undocumented) -export const CENTER: (children: MfmInline[]) => NodeType<'center'>; - -// @public (undocumented) -export const CODE_BLOCK: (code: string, lang: string | null) => NodeType<'blockCode'>; - -// @public (undocumented) -export const EMOJI_CODE: (name: string) => NodeType<'emojiCode'>; - -// @public (undocumented) -export function extract(nodes: MfmNode[], predicate: (node: MfmNode) => boolean): MfmNode[]; - -// @public (undocumented) -export const FN: (name: string, args: MfmFn['props']['args'], children: MfmFn['children']) => NodeType<'fn'>; - -// @public (undocumented) -export const HASHTAG: (value: string) => NodeType<'hashtag'>; - -// @public (undocumented) -export const INLINE_CODE: (code: string) => NodeType<'inlineCode'>; - -// @public (undocumented) -export function inspect(node: MfmNode, action: (node: MfmNode) => void): void; - -// @public (undocumented) -export function inspect(nodes: MfmNode[], action: (node: MfmNode) => void): void; - -// @public (undocumented) -export function isMfmBlock(node: MfmNode): node is MfmBlock; - -// @public (undocumented) -export const ITALIC: (children: MfmInline[]) => NodeType<'italic'>; - -// @public (undocumented) -export const LINK: (silent: boolean, url: string, children: MfmInline[]) => NodeType<'link'>; - -// @public (undocumented) -export const MATH_BLOCK: (formula: string) => NodeType<'mathBlock'>; - -// @public (undocumented) -export const MATH_INLINE: (formula: string) => NodeType<'mathInline'>; - -// @public (undocumented) -export const MENTION: (username: string, host: string | null, acct: string) => NodeType<'mention'>; - -// @public (undocumented) -export type MfmBlock = MfmQuote | MfmSearch | MfmCodeBlock | MfmMathBlock | MfmCenter; - -// @public (undocumented) -export type MfmBold = { - type: 'bold'; - props?: Record; - children: MfmInline[]; -}; - -// @public (undocumented) -export type MfmCenter = { - type: 'center'; - props?: Record; - children: MfmInline[]; -}; - -// @public (undocumented) -export type MfmCodeBlock = { - type: 'blockCode'; - props: { - code: string; - lang: string | null; - }; - children?: []; -}; - -// @public (undocumented) -export type MfmEmojiCode = { - type: 'emojiCode'; - props: { - name: string; - }; - children?: []; -}; - -// @public (undocumented) -export type MfmFn = { - type: 'fn'; - props: { - name: string; - args: Record; - }; - children: MfmInline[]; -}; - -// @public (undocumented) -export type MfmHashtag = { - type: 'hashtag'; - props: { - hashtag: string; - }; - children?: []; -}; - -// @public (undocumented) -export type MfmInline = MfmUnicodeEmoji | MfmEmojiCode | MfmBold | MfmSmall | MfmItalic | MfmStrike | MfmInlineCode | MfmMathInline | MfmMention | MfmHashtag | MfmUrl | MfmLink | MfmFn | MfmPlain | MfmText; - -// @public (undocumented) -export type MfmInlineCode = { - type: 'inlineCode'; - props: { - code: string; - }; - children?: []; -}; - -// @public (undocumented) -export type MfmItalic = { - type: 'italic'; - props?: Record; - children: MfmInline[]; -}; - -// @public (undocumented) -export type MfmLink = { - type: 'link'; - props: { - silent: boolean; - url: string; - }; - children: MfmInline[]; -}; - -// @public (undocumented) -export type MfmMathBlock = { - type: 'mathBlock'; - props: { - formula: string; - }; - children?: []; -}; - -// @public (undocumented) -export type MfmMathInline = { - type: 'mathInline'; - props: { - formula: string; - }; - children?: []; -}; - -// @public (undocumented) -export type MfmMention = { - type: 'mention'; - props: { - username: string; - host: string | null; - acct: string; - }; - children?: []; -}; - -// @public (undocumented) -export type MfmNode = MfmBlock | MfmInline; - -// @public (undocumented) -export type MfmPlain = { - type: 'plain'; - props?: Record; - children: MfmText[]; -}; - -// @public (undocumented) -export type MfmQuote = { - type: 'quote'; - props?: Record; - children: MfmNode[]; -}; - -// @public (undocumented) -export type MfmSearch = { - type: 'search'; - props: { - query: string; - content: string; - }; - children?: []; -}; - -// @public (undocumented) -export type MfmSimpleNode = MfmUnicodeEmoji | MfmEmojiCode | MfmText | MfmPlain; - -// @public (undocumented) -export type MfmSmall = { - type: 'small'; - props?: Record; - children: MfmInline[]; -}; - -// @public (undocumented) -export type MfmStrike = { - type: 'strike'; - props?: Record; - children: MfmInline[]; -}; - -// @public (undocumented) -export type MfmText = { - type: 'text'; - props: { - text: string; - }; - children?: []; -}; - -// @public (undocumented) -export type MfmUnicodeEmoji = { - type: 'unicodeEmoji'; - props: { - emoji: string; - }; - children?: []; -}; - -// @public (undocumented) -export type MfmUrl = { - type: 'url'; - props: { - url: string; - brackets?: boolean; - }; - children?: []; -}; - -// @public (undocumented) -export const N_URL: (value: string, brackets?: boolean) => NodeType<'url'>; - -// @public (undocumented) -export type NodeType = T extends 'quote' ? MfmQuote : T extends 'search' ? MfmSearch : T extends 'blockCode' ? MfmCodeBlock : T extends 'mathBlock' ? MfmMathBlock : T extends 'center' ? MfmCenter : T extends 'unicodeEmoji' ? MfmUnicodeEmoji : T extends 'emojiCode' ? MfmEmojiCode : T extends 'bold' ? MfmBold : T extends 'small' ? MfmSmall : T extends 'italic' ? MfmItalic : T extends 'strike' ? MfmStrike : T extends 'inlineCode' ? MfmInlineCode : T extends 'mathInline' ? MfmMathInline : T extends 'mention' ? MfmMention : T extends 'hashtag' ? MfmHashtag : T extends 'url' ? MfmUrl : T extends 'link' ? MfmLink : T extends 'fn' ? MfmFn : T extends 'plain' ? MfmPlain : T extends 'text' ? MfmText : never; - -// @public (undocumented) -export function parse(input: string, opts?: Partial<{ - nestLimit: number; -}>): MfmNode[]; - -// @public (undocumented) -export function parseSimple(input: string): MfmSimpleNode[]; - -// @public (undocumented) -export const PLAIN: (text: string) => NodeType<'plain'>; - -// @public (undocumented) -export const QUOTE: (children: MfmNode[]) => NodeType<'quote'>; - -// @public (undocumented) -export const SEARCH: (query: string, content: string) => NodeType<'search'>; - -// @public (undocumented) -export const SMALL: (children: MfmInline[]) => NodeType<'small'>; - -// @public (undocumented) -export const STRIKE: (children: MfmInline[]) => NodeType<'strike'>; - -// @public (undocumented) -export const TEXT: (value: string) => NodeType<'text'>; - -// @public (undocumented) -function toString_2(tree: MfmNode[]): string; - -// @public (undocumented) -function toString_2(node: MfmNode): string; -export { toString_2 as toString } - -// @public (undocumented) -export const UNI_EMOJI: (value: string) => NodeType<'unicodeEmoji'>; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/etc/cfm-js.api.md b/etc/mfm-js.api.md similarity index 99% rename from etc/cfm-js.api.md rename to etc/mfm-js.api.md index 4a4c344..b664143 100644 --- a/etc/cfm-js.api.md +++ b/etc/mfm-js.api.md @@ -1,4 +1,4 @@ -## API Report File for "mfc-js" +## API Report File for "mfm-js" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). diff --git a/package.json b/package.json index 5c26f4a..fbdeaa0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "mfc-js", - "version": "0.3.0", - "baseMfmJsVersion": "0.28.0", + "name": "mfm-js", + "version": "0.3.1", + "baseUpstreamVersion": "0.28.0", "description": "An MFM parser implementation with TypeScript", "type": "module", "packageManager": "pnpm@12.14.0",