Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/kokonect-link/mfm.js
Browse files Browse the repository at this point in the history
  • Loading branch information
noridev committed Oct 5, 2024
2 parents 1551b25 + 8f0bb62 commit 076de13
Show file tree
Hide file tree
Showing 24 changed files with 391 additions and 258 deletions.
11 changes: 9 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,21 @@ module.exports = {
'prefer-arrow-callback': ['error'],
'no-throw-literal': ['error'],
'no-param-reassign': ['warn'],
'no-constant-condition': ['warn'],
'no-constant-condition': ['warn', {
checkLoops: false,
}],
'no-empty-pattern': ['warn'],
'@typescript-eslint/no-unnecessary-condition': ['warn'],
'@typescript-eslint/no-unnecessary-condition': ['warn', {
allowConstantLoopConditions: true,
}],
'@typescript-eslint/no-inferrable-types': ['warn'],
'@typescript-eslint/no-non-null-assertion': ['warn'],
'@typescript-eslint/explicit-function-return-type': ['warn'],
'@typescript-eslint/no-misused-promises': ['error', {
'checksVoidReturn': false,
}],
'@typescript-eslint/no-unused-vars': ['error', {
"argsIgnorePattern": "^_",
}]
},
};
4 changes: 2 additions & 2 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 16.5.0
node-version: 16.10.0

- name: Cache dependencies
uses: actions/cache@v2
Expand All @@ -37,4 +37,4 @@ jobs:

- name: Show report
if: always()
run: cat temp/cherrypick-mfm-js.api.md
run: cat temp/cfm.js.api.md
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 16.5.0
node-version: 16.10.0

- name: Cache dependencies
uses: actions/cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [16.5.0]
node-version: [16.10.0]

steps:
- name: Checkout
Expand Down
30 changes: 28 additions & 2 deletions CHANGELOG_CHERRYPICK.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
## 0.x.x-cp-1.x.x
## 0.x.x-cherrypick-x
출시일: unreleased<br>
전체 변경 사항을 확인하려면, [CHANGELOG.md#13xx](CHANGELOG.md#0xxx) 문서를 참고하십시오.
전체 변경 사항을 확인하려면, [CHANGELOG.md#0xxx](CHANGELOG.md#0xxx) 문서를 참고하십시오.
## NOTE
Expand All @@ -21,20 +21,46 @@

이 문서는 CherryPick에서의 사용을 상정한 변경 사항만 포함합니다.

## 0.24.0-cherrypick.6
출시일: 2024/10/05<br>
전체 변경 사항을 확인하려면, [CHANGELOG.md#0240](CHANGELOG.md#0240) 문서를 참고하십시오.

## NOTE
- cherrypick-mfm-js를 cfm-js로 변경

---

## 0.24.0-cherrypick.5
출시일: 2024/10/04<br>
전체 변경 사항을 확인하려면, [CHANGELOG.md#0240](CHANGELOG.md#0240) 문서를 참고하십시오.

### Features
- feat: parse <plain> in parseSimple (misskey-dev/mfm.js#146)

### Bugfixes
- fix: lints and kill any (misskey-dev/mfm.js#142)
- fix: type error (misskey-dev/mfm.js#147)

---

## 0.24.0-cherrypick.4
출시일: 2023/12/18<br>
전체 변경 사항을 확인하려면, [CHANGELOG.md#0240](CHANGELOG.md#0240) 문서를 참고하십시오.

## NOTE
모듈이 npm을 통해 배포되도록 변경

---

## 0.24.0-cherrypick.3
출시일: 2023/12/18<br>
전체 변경 사항을 확인하려면, [CHANGELOG.md#0240](CHANGELOG.md#0240) 문서를 참고하십시오.

## NOTE
cherrypick-mfm-js.api.md를 참조하도록 변경

---

## 0.23.3-cherrypick.2
출시일: 2023/06/16<br>
전체 변경 사항을 확인하려면, [CHANGELOG.md#0233](CHANGELOG.md#0233) 문서를 참고하십시오.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ PRを作る際は、`npm run api`コマンドを実行してAPIレポートを
### Codecov
このプロジェクトではカバレッジの計測に[Codecov](https://about.codecov.io/)を導入しています。カバレッジは、コードがどれくらいテストでカバーされているかを表すものです。

カバレッジ計測はCIで自動的に行われ、特に操作は必要ありません。カバレッジは[ここ](https://codecov.io/gh/kokonect-link/mfm.js)から見ることができます。
カバレッジ計測はCIで自動的に行われ、特に操作は必要ありません。カバレッジは[ここ](https://codecov.io/gh/kokonect-link/cfm.js)から見ることができます。

また、各PRに対してもそのブランチのカバレッジが自動的に計算され、マージ先のカバレッジとの差分を含んだレポートがCodecovのbotによりコメントされます。これにより、そのPRをマージすることでどれくらいカバレッジが増加するのか/減少するのかを確認することができます。

Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# mfm.js
An MFM parser implementation with TypeScript.
[Try it out!](https://runkit.com/npm/cherrypick-mfm-js)
# cfm.js
An CFM parser implementation with TypeScript.
[Try it out!](https://runkit.com/npm/cfm.js)

[![Test](https://github.com/kokonect-link/mfm.js/actions/workflows/test.yml/badge.svg)](https://github.com/kokonect-link/mfm.js/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/kokonect-link/mfm.js/branch/develop/graph/badge.svg?token=irAWFiHK8T)](https://codecov.io/gh/kokonect-link/mfm.js)
[![Test](https://github.com/kokonect-link/cfm.js/actions/workflows/test.yml/badge.svg)](https://github.com/kokonect-link/cfm.js/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/kokonect-link/cfm.js/branch/develop/graph/badge.svg?token=irAWFiHK8T)](https://codecov.io/gh/kokonect-link/cfm.js)

[![NPM](https://nodei.co/npm/cherrypick-mfm-js.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/cherrypick-mfm-js)
[![NPM](https://nodei.co/npm/cfm.js.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/cfm.js)

## Installation
```
npm i cherrypick-mfm-js
npm i cfm.js
```

## Usage
Please see [docs](./docs/index.md) for the detail.

TypeScript:
```ts
import * as mfm from 'cherrypick-mfm-js';
import * as cfm from 'cfm.js';

const inputText =
`<center>
Expand All @@ -28,26 +28,26 @@ I'm @ai, A bot of misskey!
https://github.com/syuilo/ai
</center>`;

// Generate a MFM tree from the full MFM text.
// Generate a CFM tree from the full CFM text.
const mfmTree = mfm.parse(inputText);

// Generate a MFM tree from the simple MFM text.
// Generate a CFM tree from the simple CFM text.
const simpleMfmTree = mfm.parseSimple('I like the hot soup :soup:​');

// Reverse to a MFM text from the MFM tree.
// Reverse to a CFM text from the CFM tree.
const text = mfm.toString(mfmTree);

```

## Develop
### 1. Clone
```
git clone https://github.com/kokonect-link/mfm.js.git
git clone https://github.com/kokonect-link/cfm.js.git
```

### 2. Install packages
```
cd mfm.js
cd cfm.js
npm i
```

Expand Down
4 changes: 2 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## parse API
入力文字列からノードツリーを生成します。
全てのMFM構文を利用可能です
全てのCFM構文を利用可能です

例:
```ts
Expand Down Expand Up @@ -31,7 +31,7 @@ console.log(JSON.stringify(nodes));
```

## toString API
ノードツリーからMFM文字列を生成します
ノードツリーからCFM文字列を生成します

例:
```ts
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
### [API](api.md)
ライブラリが提供している関数や型定義などについての説明です。

### [MFM構文とノード構造の仕様](syntax.md)
サポートしているMFM構文やノード構造についての説明です
### [CFM構文とノード構造の仕様](syntax.md)
サポートしているCFM構文やノード構造についての説明です
18 changes: 9 additions & 9 deletions docs/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- [URL](#url)
- [リンク](#link)
- [絵文字コード(カスタム絵文字)](#emoji-code)
- [MFM関数](#fn)
- [CFM関数](#fn)
- [Unicode絵文字](#unicode-emoji)
- [テキスト](#text)

Expand Down Expand Up @@ -58,12 +58,12 @@

## 形式
```
MFM 書き方 Search
MFM 書き方 検索
MFM 書き方 검색
MFM 書き方 [Search]
MFM 書き方 [検索]
MFM 書き方 [검색]
CFM 書き方 Search
CFM 書き方 検索
CFM 書き方 검색
CFM 書き方 [Search]
CFM 書き方 [検索]
CFM 書き方 [검색]
```

## 詳細
Expand All @@ -74,8 +74,8 @@ MFM 書き方 [검색]
{
type: 'search',
props: {
query: 'MFM 書き方',
content: 'MFM 書き方 Search'
query: 'CFM 書き方',
content: 'CFM 書き方 Search'
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions etc/cherrypick-mfm-js.api.md → etc/cfm.js.api.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## API Report File for "cherrypick-mfm-js"
## API Report File for "cfm.js"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
Expand Down Expand Up @@ -190,7 +190,7 @@ export type MfmSearch = {
};

// @public (undocumented)
export type MfmSimpleNode = MfmUnicodeEmoji | MfmEmojiCode | MfmText;
export type MfmSimpleNode = MfmUnicodeEmoji | MfmEmojiCode | MfmText | MfmPlain;

// @public (undocumented)
export type MfmSmall = {
Expand Down
52 changes: 26 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cherrypick-mfm-js",
"version": "0.24.0-cherrypick.4",
"description": "An MFM parser implementation with TypeScript",
"name": "cfm.js",
"version": "0.24.0-cherrypick.6",
"description": "An CFM parser implementation with TypeScript",
"main": "./built/index.js",
"types": "./built/index.d.ts",
"scripts": {
Expand All @@ -18,7 +18,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/kokonect-link/mfm.js.git"
"url": "git+https://github.com/kokonect-link/cfm.js.git"
},
"author": "Marihachi",
"license": "MIT",
Expand Down
Loading

0 comments on commit 076de13

Please sign in to comment.