mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-05 06:50:28 +03:00
Parsing HTML to Markdown AST (#847)
* Force mentions to have a space after the # * Use types for rendering * Parse HTML * Add code block support * Add table support * Allow starting heading without a space * Escape relevant plaintext areas * Resolve many crashes * Use better matrix id regex * Don't match . after id * Don't parse mentions as links * Add emote support * Only emit HTML link if necessary * Implement review changes
This commit is contained in:
parent
d43e41e1ba
commit
a8f374dd43
4 changed files with 265 additions and 46 deletions
|
|
@ -10,6 +10,7 @@ import { setFavicon } from '../../util/common';
|
|||
import LogoSVG from '../../../public/res/svg/cinny.svg';
|
||||
import LogoUnreadSVG from '../../../public/res/svg/cinny-unread.svg';
|
||||
import LogoHighlightSVG from '../../../public/res/svg/cinny-highlight.svg';
|
||||
import { html, plain } from '../../util/markdown';
|
||||
|
||||
function isNotifEvent(mEvent) {
|
||||
const eType = mEvent.getType();
|
||||
|
|
@ -257,8 +258,18 @@ class Notifications extends EventEmitter {
|
|||
scale: 8,
|
||||
});
|
||||
|
||||
const content = mEvent.getContent();
|
||||
|
||||
const state = { kind: 'notification', onlyPlain: true };
|
||||
let body;
|
||||
if (content.format === 'org.matrix.custom.html') {
|
||||
body = html(content.formatted_body, state);
|
||||
} else {
|
||||
body = plain(content.body, state);
|
||||
}
|
||||
|
||||
const noti = new window.Notification(title, {
|
||||
body: mEvent.getContent().body,
|
||||
body: body.plain,
|
||||
icon,
|
||||
tag: mEvent.getId(),
|
||||
silent: settings.isNotificationSounds,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue