mirror of
https://github.com/RGBCube/cinny
synced 2025-08-01 17:37:46 +00: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
|
@ -354,4 +354,37 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
& ul.contains-task-list {
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
& table {
|
||||
background-color: var(--bg-surface-hover);
|
||||
border-radius: calc(var(--bo-radius) / 2);
|
||||
border-spacing: 0;
|
||||
border: 1px solid var(--bg-surface-border);
|
||||
|
||||
& td, & th {
|
||||
padding: var(--sp-extra-tight);
|
||||
border: 1px solid var(--bg-surface-border);
|
||||
border-width: 0 1px 1px 0;
|
||||
&:last-child {
|
||||
border-width: 0;
|
||||
border-bottom-width: 1px;
|
||||
[dir=rtl] & {
|
||||
border-width: 0 1px 1px 0;
|
||||
}
|
||||
}
|
||||
[dir=rtl] &:first-child {
|
||||
border-width: 0;
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
}
|
||||
& tbody tr:nth-child(2n + 1) {
|
||||
background-color: var(--bg-surface-hover);
|
||||
}
|
||||
& tr:last-child td {
|
||||
border-bottom-width: 0px !important;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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