No description
Find a file
2024-06-29 09:30:45 +01:00
.forgejo/workflows Delete .forgejo/workflows/lint.yml 2023-12-27 22:56:13 +01:00
docs explain how to test local changes 2024-03-09 12:47:05 +00:00
etc fix type error (#147) 2024-06-15 16:13:59 +09:00
src fix types in our difference function 2024-06-29 09:30:45 +01:00
test Merge remote-tracking branch 'misskey/develop' into from-upstream 2024-06-29 09:23:12 +01:00
test-d fix lints and kill any (#142) 2024-06-13 11:19:25 +09:00
.editorconfig update CI configuration 2021-04-01 11:37:44 +09:00
.eslintignore Update .eslintignore 2022-01-10 01:51:04 +09:00
.eslintrc.js fix lints and kill any (#142) 2024-06-13 11:19:25 +09:00
.gitignore add package-lock 2021-07-31 15:15:44 +09:00
.gitlab-ci.yml fix(ci): replace broken token with CI_JOB_TOKEN 2024-04-03 09:19:36 +00:00
api-extractor.json Introduce api-extractor and lint 2021-07-31 15:12:43 +09:00
CHANGELOG.md 0.24.0 2023-12-18 13:20:29 +09:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2021-08-23 23:43:00 +09:00
codecov.yml Introduce coverage integration 2021-06-26 23:48:46 +09:00
CONTRIBUTING.md Update contribution guides 2021-08-28 15:52:36 +09:00
jest.config.ts Introduce coverage integration 2021-06-26 23:48:46 +09:00
LICENSE update copyright 2022-01-01 21:57:03 +09:00
package-lock.json Adjust package info for new git instance 2024-02-02 19:42:15 +00:00
package.json Adjust package info for new git instance 2024-02-02 19:42:15 +00:00
README.md upd: README 2023-12-22 01:52:03 +01:00
tsconfig.json TypeScript版パーサーのマージ (#124) 2022-07-22 02:21:56 +09:00

sfm.js

An SFM parser implementation with fixes based on MFM

Installation

npm config set @sharkey:registry https://git.joinsharkey.org/api/packages/Sharkey/npm/
npm i @sharkey/sfm-js

Usage

Please see docs for the detail.

TypeScript:

import * as mfm from '@sharkey/sfm-js';

const inputText =
`<center>
Hello $[tada everynyan! 🎉]

I'm @ai, A bot of misskey!

https://github.com/syuilo/ai
</center>`;

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

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

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

Develop

1. Clone

git clone https://git.joinsharkey.org/Sharkey/sfm.js.git

2. Install packages

cd sfm.js
npm i

3. Build

npm run build

Use the interactive CLI parser

full parser:

npm run parse

simple parser:

npm run parse-simple

License

This software is released under the MIT License.