https://github.com/lachee/himark
HiMark is a Markdown Editor specializing in comments and discussion uses.
https://github.com/lachee/himark
Last synced: 14 days ago
JSON representation
HiMark is a Markdown Editor specializing in comments and discussion uses.
- Host: GitHub
- URL: https://github.com/lachee/himark
- Owner: Lachee
- License: mit
- Created: 2023-05-25T02:11:00.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-30T08:48:36.000Z (almost 2 years ago)
- Last Synced: 2025-01-25T09:11:50.467Z (over 1 year ago)
- Language: TypeScript
- Size: 902 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
HiMark
This package is a wrapper around CodeMirror to add functionality like Discord's or GitHub's comment editing box.
Focused around comments, this forgoes a lot of fancy preview functionality for actually useful things such as built in @mention support using Tribute.JS

# Usage
Usage is not yet documented, but here is a very basic browser usage to get you started:
This example users the `/search` endpoint which returns a SELECT2 response.
```js
const editor = new HiMark.Editor(document.getElementById('md-editor'), {
placeholder: 'Write comment...',
plugins: [
new HiMark.Plugins.CheckboxPlugin(),
new HiMark.Plugins.MentionPlugin({
collections: [
{
trigger: '@',
lookup: 'text',
fillAttr: 'text',
allowSpaces: true,
selectTemplate: ({ original }) => `[@\${original.text}](#/identity/\${original.id})`,
values: async (text, cb) => {
$.ajax({
url: '/search?q=' + encodeURIComponent(text),
success: (data, status, response) => cb(data.results),
})
}
}
]
}),
]
});
```
yes, it uses jquery... it's just an example and could easily be replaced with `fetch`.