Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-line code blocks apply monospace font to entire message #853

Open
emgrav opened this issue Jan 16, 2020 · 5 comments
Open

Multi-line code blocks apply monospace font to entire message #853

emgrav opened this issue Jan 16, 2020 · 5 comments

Comments

@emgrav
Copy link

emgrav commented Jan 16, 2020

When using multi-line code blocks in a message, the entire message appears to be rendered as preformatted text. RiotX v0.12.0. See below for example.

2020-01-16-192429_322x179_scrot

Message source containing multi-line code block.
2020-01-16-192636_461x431_scrot

The <pre> tag is correctly placed in formatted_body, but the message renders incorrectly.

@violoncelloCH
Copy link

It also makes the whole message horizontally scrollabel and not auto breaking if there is a code block..

@bmarty
Copy link
Member

bmarty commented Jan 16, 2020

Yes, those are limitations we are aware of, thanks for having created the issue.

To be honest, we are thinking on removing the scrollability on code blocks and rather replace it with a real code previewer, which will be opened when you click on a code block, and which will display line numbers on the left, will be scrollable in each direction and eventually have syntax coloration. Some libraries may doing this quite well.

This could also be used for (decrypted) event source preview, rather than the simple dialog we have so far.

@brinsche
Copy link

If there are no good syntax highlighting libraries in kotlin or java it might be a cool project for someone to wrap https://github.com/trishume/syntect in a usable library for Android. It uses the SublimeText syntaxes for highlighting and it's probably a lot faster than doing the highlighting in .js. The easiest way would still be generating html like this https://github.com/trishume/syntect/blob/master/examples/synhtml.rs and displaying it in a webview, but a syntect -> spannable conversion would be really cool

To use rust libraries from gradle this might be helpful: https://github.com/mozilla/rust-android-gradle

@MyriaCore
Copy link

MyriaCore commented May 17, 2020

@bmarty This is totally a subjective thing, but I personally would prefer code block scrollability over a dedicated code view, since a lot of people I know (myself included) mix code blocks with prose when collaborating with others. A dedicated code view would take you away from the prose as you look at the code, at least from my current understanding of how that'd be implemented.

@ydnax
Copy link

ydnax commented May 29, 2020

related/more infos: #1375

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants