Open poljar opened 4 years ago
Is the subset of HTML that is used in Matrix documented anywhere?
Is it necessary to implement a parser from scratch, or can existing parsers like html5ever be used?
Of course not, I actually looked a bit into this and I think kuchiki, which builds on top of html5ever, provides what we need, if not a custom tree sink for html5ever might be needed. In any case, no parser from scratch is needed.
use kuchiki::traits::*;
fn main() {
let html = r"
<h1>Example</h1>
<p class='foo'>Hello, world!</p>
<p class='foo'>I love HTML</p>
";
let document = kuchiki::parse_html().one(html);
for element in document.traverse() {
println!("{:?}", element);
}
}
Seems like this would be good as a seperate project and upstreamed for other clients to use as well.
Somehow related, but not really part of rendering incoming messages: How would I enter multi-lined code snippets such as:
\```<shift+enter>
foo<shift+enter>
bar<shift+enter>
```<enter>
I guess this is more something which needs to be tackled in weechat, rather than here, right?
There's a script for this: https://weechat.org/scripts/source/multiline.pl.html/
There are plugins for that, such as weechat-edit
I maintain a fork of that which you might want to check
On 22/06/10 02:25am, Alexander W. Janssen wrote:
Somehow related, but not really part of rendering incoming messages: How would I enter multi-lined code snippets such as:
\```<shift+enter> foo<shift+enter> bar<shift+enter> ```<enter> I guess this is more something which needs to be tackled in weechat, rather than her, right? -- Reply to this email directly or view it on GitHub: https://github.com/poljar/weechat-matrix-rs/issues/5#issuecomment-1152161885 You are receiving this because you are subscribed to this thread. Message ID: ***@***.***>
Some event types can have a formatted body, this body contains a HTML formatted message.
The formatting includes colors, quotes, links, code snippets, etc...
To properly handle this we need to implement a parser and formatter.
Care should be taken when implementing this so that advanced features like hiding/showing of code snippets is possible.