mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-05 23:10:28 +03:00
replaced commonmark with micromark and gfm support
This commit is contained in:
parent
59226365c5
commit
f49048c6e1
5 changed files with 662 additions and 100 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import EventEmitter from 'events';
|
||||
import { Parser, HtmlRenderer } from 'commonmark';
|
||||
import { micromark } from 'micromark';
|
||||
import { gfm, gfmHtml } from 'micromark-extension-gfm';
|
||||
import encrypt from 'browser-encrypt-attachment';
|
||||
import cons from './cons';
|
||||
import settings from './settings';
|
||||
|
|
@ -81,10 +82,11 @@ function getVideoThumbnail(video, width, height, mimeType) {
|
|||
}
|
||||
|
||||
function getFormattedBody(markdown) {
|
||||
const reader = new Parser();
|
||||
const writer = new HtmlRenderer();
|
||||
const parsed = reader.parse(markdown);
|
||||
return writer.render(parsed);
|
||||
const result = micromark(markdown, {
|
||||
extensions: [gfm()],
|
||||
htmlExtensions: [gfmHtml],
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function getReplyFormattedBody(roomId, reply) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue