Sign in to follow this  
abdus

Better mobile reading experience for code snippets in forum

Recommended Posts

Code snippets are very hard to read on small screens due to lack of white-space: pre CSS property on <pre> tags. This causes very weird text wrapping. Adding this allows code to scroll sideways, which also preserves the whitespace properly. 

Here's the problem and proposed change in action

Readable on large screens, overflow works ✓

Readable on large screens

Unreadable on small screens, text should not wrap ✘

photo5992124357910046740.thumb.jpg.dd30e352a3348bfd5a8afd70b7b05a4f.jpg

 

Proposal: add white-space: pre on <pre> elements. See it in action

2017-04-05_20-18-03.mp4 (770KB)

or GIPHY link

  • Like 4

Share this post


Link to post
Share on other sites

Another improvement would be supporting some subset of markdown.
It's much easier to write code snippets in Github Flavored and Markdown Extra. They support fenced code with backticks, which allows you specify the language for syntax highlighting with backticks as well (```php for example). Having to fiddle with font settings to indicate inline code snippets is frustrating when you're able to just surround it with backticks in Markdown `like this`

A disadvantage would be the inability to use align/colors/font/size options, but they're distracting anyway and lack of only brings more consistency to the content structure.

https://github.com/timsayshey/Ghost-Markdown-Editor is a really good editor concept, you can put placeholders, then add images later

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By abdus
      For the last week or so, a number of accouts have started to post status updates with (mostly) unrelated content. I've checked out the submission histories of ~20 of them, and none of them has a recent post. They were registered long time ago and made several status updates over time. I started noticing them after the last week's forum update. Something about it allowed these status updates to surface, and now around ~10-15 updates are posted daily, which is enough to flood the activity stream.
      Is anyone else bothered by this?
      These are from the last 24 hours



    • By abdus
      I'm having this issue for the last week or so. When I sign in, I make sure to check "Remember Me" box, but it doesn't seem to change anything. My account gets logged out after an hour or so, even more frequently on my smartphone. Issue persists in different browsers and devies. 
      I am using a VPN (actually a ShadowSocks proxy) but how I connect shouldn't matter, because session cookies are sent with each HTTP request
      Does anyone know what's happening and how I can stop this?
      This is how cookies look when I log out

      This is after logging in

      Cookies seem to be set correctly, their expiration is set to 3 months later, but it expires anyway.
    • By louisstephens
      I guess this is the right place to post this. Just this morning I went to like an answer someone had given, and was met with a popup stating: "Unable to give reputation to this user". Has anyone encountered this before, or is there some "cap" on users with a certain ratio (reputation to posts) that is keeping me from providing reputation. It was not a big deal, but I wanted to give credit to where credit was due.
    • By rayorg
      Hi all,
      I discovered Processwire a little over a week ago and have been playing around with it ever since.  Going through the tutorials, creating templates, pages, etc. and see what a nice system it is.  However, I'm led to believe that's it's not meant for user-centric sites, and by that I mean a site where you expect to have hundreds/thousands of users and expect them to log in, update their profiles, submit content, create galleries, message each other, chat in the Forum, get email notifications, etc. etc., you get the idea.  
      I was trying to update the Profile page last night by adding fields for First Name, Last Name, Profile Pic, and a bunch of others and realized that it's not that easy to do.  There's not even a template.php file for the Profile page.   Am I just not seeing it because I'm so inexperienced with the CMS?  Or, is Processwire really geared more towards sites where not much user interaction is expected?
      thanks,
      Ray
    • By Doc
      Hi,
      I'm looking for a nice forum I could use with PW.
      I'd like to use the same credentials for the PW website and for the forum.
      Any advice on that ?
      Thanks