news icon indicating copy to clipboard operation
news copied to clipboard

Code block render.

Open AuroreRoma opened this issue 3 years ago • 2 comments

Checklist

  • [x] I checked, but didn't find any duplicates (open OR closed) of this issue in the repo.
  • [x] This issue contains only one feature request. I will open one issue for every feature I want to request.

What feature do you want?

Add a proper render for the block of code.

Why do you want this feature?

I follow a lot of technicals blogs, and often enough, they share some code, and with the current version of the application, this code is messed up.

You can see in the following example than the syntaxic coloration works, but the indenting is not reader-friendly at all.

image

(By the way, regardless of this issue, i love this application, thank you a lot for this.)

AuroreRoma avatar Nov 24 '22 07:11 AuroreRoma

The problem with code blocks is the fact that they are quite wide so the best formatting would require horizontal scroll (as many websites do, including my own). Line-wrapping would ruin the code and horizontal scrolling doesn't really play well with the native Android widgets. In theory, a monolithic TextView can be split into several pieces of varying width, but this approach has some nasty side effects with text selection and so on.

In my view, it's better to open those technical posts in an embedded web view, and the News app fully supports this use case, it has a per-feed settings screen which allows users to override global settings for some particular feeds.

I'm not rejecting this idea completely and PRs are always welcome, but re-creating the whole HTML/CSS stack with the native Android widgets doesn't make much sense when the web view already does it better than we ever could.

bubelov avatar Nov 24 '22 12:11 bubelov

Okay, thanks for the answer :+1:

AuroreRoma avatar Nov 24 '22 13:11 AuroreRoma