1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Suggestion New Text Editor Button for Inline Code

Discussion in 'Community Chat' started by ParodyKnaveBob, Sep 30, 2019.

  1. ParodyKnaveBob

    ParodyKnaveBob The Laughing Rogue

    Joined:
    Jun 23, 2016
    Posts:
    537
    To Whom It May Concern:
    Howdy, $:^ ]

    I propose a new button for the GMC's text editor to facilitate mentioning code in prose without the user's need for lots of extra formatting. I'll demonstrate why this would be so tremendously useful. I'm writing "I" below as shorthand: I expect many of you Programming forum helpers are "I' just the same.

    Preventing Forest Fires

    Sure, all you need is to add a break in the with loop after arr_foes == other.id finds your target!

    Uh-oh, now my post is broken. Lemme go edit everything by hand.
    All right, the italics are fixed, but what about my array that had i for the index? Maybe add a whole code block for one little mid-sentence mention?

    Sure, all you need is to add a break in the with loop after
    Code:
    arr_foes[i] == other.id
    finds your target!

    Or, skip the simple sentence altogether and rewrite someone's whole code block, depriving one of mini-solving the exact place to write the exact keyword, vs. unthinking copy-paste? Or, corrupt the code by making it arr_foes{i} or arr_foes[ii] or what-have-you, potentially confusing someone, unless of course, I start writing more unnecessary text to explain? Or, perhaps I've dug up the Help page to learn I can wrap code in [plain][/plain], despite it not being in the toolbar, not even hidden (like the tucked-away "Code" option which so many new users clearly don't find) under the "Insert..." dropdown button? If I know the [plain] feature, at least I can get...

    Sure, all you need is to add a break in the with loop after arr_foes[i] == other.id finds your target!

    On the other hand, what if I had replied with [quote] blocks (or used an un/ordered list) in the broken post, too? When going back to edit, ~exhale~ so very much weird, broken formatting. Fixing that in the editor usually doesn't even stick because of irrelevant colors and alignments and what-all-else the editor adds (despite my not changing any colors, alignments, etc. in the first place). Painful. I pretty much have to fix all of that by hand-deleting lots and lots via the non-rich-text editor.

    Oh, and if my old HTML 3.x days $;^ J influence me to write [plaintext] instead? Or, if I'm more used to [noparse] from other places online? Then, despite my "secret" (non-toolbar-advertised) knowledge, I still break the post, thus still get to edit the post to fix things, sometimes searching online to remember the proper Xenforo BB code to do so.

    Likewise, I often inform newbies how to wrap code in code blocks, meaning I write more BB code to tell Xenforo not to parse the other BB code I do want to show.

    Final miscellaneous note, I don't face the issue myself much, but I do see others getting emoji sporadically injected into their inline code.

    Pretty Clear

    Pretty and clear, actually. A few of us often designate inline code with a standard code font:

    Sure, all you need is to add a break in the with loop after arr_foes == other.id finds your target!

    Uh-oh, I broke the italics
    again. Redoing:

    Sure, all you need is to add a break in the with loop after arr_foes[i] == other.id finds your target!

    See how that font adds keyword clarity to the otherwise normal English words, break and with, mixed into the sentence, not to mention to the comparison expression? It's not necessary, but it's helpful, and it's pretty. However, to achieve this touch of polish, I must either A. type [font=Courier New][/font] around text or B. highlight text and press the Font Family dropdown button, then Courier New option. The toolbar option is faster, but that means I finish typing a section, remove hand from keyboard, use mouse to highlight text 1, reach up to toolbar, click, click, highlight text 2, reach back to toolbar, click, click, text 3, toolbar, click, click, return hand to keyboard, and get back to typing (hoping I haven't forgotten my next line of thought) -- or, type the whole post first before then scouring over it to add all my inline code highlights.

    Presto!

    One simple button could expedite writing and reading of little code bits. If that button existed, then it could easily add polish, too. I've demonstrated the why; now, I'll demonstrate the how.
    What new keyword to use?
    • [inline] is clear and memorable but perhaps lengthy, especially when peppering throughout a sentence or paragraph.
    • [incode] is just as long and looks like confusion waiting to happen due to the mental homophone encode.
    • [icode] is shorter but could easily create post-breaking typos due to [code].
    • [ic] is super short, and I want to like it. It's probably as easily memorable as [b], [i], or [s] (the main one to type anyway). I hesitate for potential [i] typos, but I know I can be overly cautious, and this is maybe likely one of those times...
    • Any better suggestions?

    Unfortunately, I see no simple way to add a keyboard shortcut, but if it's easier to type out than to click, a keyboard shortcut doesn't matter that much anyway. See above spoiler regarding ease of typing. For the rest of this post, I'll use [ic] to designate inline code. That said, my example would go from...

    ~ fully written out ~

    Sure, all you need is to add a [font=Courier New]break[/font] in the [font=Courier New]with[/font] loop after [font=Courier New][plain]arr_foes[i] == other.id[/plain][/font] finds your target!

    ~ partly written, partly WYSIWYG~

    Sure, all you need is to add a break in the with loop after [plain]arr_foes[i] == other.id[/plain] finds your target!

    ...to...

    Sure, all you need is to add a [ic]break[/ic] in the [ic]with[/ic] loop after [ic]arr_foes[i] == other.id[/ic] finds your target!

    ...and all in one go, the forum would protect and polish your code:

    Sure, all you need is to add a break in the with loop after arr_foes[i] == other.id finds your target!

    How much work would this require of YYG's GMC staff? Reviewing Xenforo's manual...
    1. Go to the BB code manager.
    2. Create a new keyword, IC.
    3. Title it Inline Code.
    4. Use simple replacement.
    5. No option support needed. (Unless someone suggests something brilliant? heheheh)
    6. Set the HTML to <span style="font-family: 'Courier New', monospace">{text}<span>. I suggest adding that "monospace" in the unheard-of event that a browser with HTML4+ capability sits on a computer with no Courier New font. ~shrug~
    7. Choose whatever button icon thingy you like. :squirrel:?
    8. Example usage: This is [IC]inline code[/IC]. ("This is [IC]inline code[/IC] text." doesn't sound right to me. Perhaps "This text is [IC]inline code[/IC]." despite not 100% matching the other examples.) I doubt >0.1% of users read this page anyway, lol.
    9. Allow in signatures.
    10. No RegEx needed if no option support.
    11. No parsing smilies, hyperlinks, or other BB code. $:^ P
    12. I have guesses about line break conversion and trimming, but I've never managed Xenforo. This also means I can't comment on the advanced options. That said, I suggest line breaks within should be parsed normally, and a button would only need to insert [IC][/IC] into the textbox -- not pop open a dialog like the Media or Insert...->Spoiler/Code buttons.
    13. Winning! (Okay, I just enjoy 13 and wanted to round up the list nicely.)
    I hope you agree how much benefit this would add -- and how much ease you'd have adding it.

    Regards,
     
    GMWolf likes this.
  2. ParodyKnaveBob

    ParodyKnaveBob The Laughing Rogue

    Joined:
    Jun 23, 2016
    Posts:
    537
    So then, I guess I'm mistaken? Seventy-two views later, and no one agrees? The people speak, but I'm deeply surprised nonetheless. Hm.
     
  3. 2Dcube

    2Dcube Member

    Joined:
    Jun 23, 2016
    Posts:
    382
    It doesn't seem that much more cumbersome to me to use bold or color to highlight words, which achieves the same result does it not?

    Code tags aren't used much as it is, and a new inline code tag might not be used as intended if it is used at all.
     
  4. ParodyKnaveBob

    ParodyKnaveBob The Laughing Rogue

    Joined:
    Jun 23, 2016
    Posts:
    537
    Thank you, Mr. cube, for the feedback. Two answers, then a question:

    As demonstrated at length in my first post, the highlighting would just be icing on the cake. The cake would be preserving the code (meaning a button on the toolbar that wrapped in {plain}{/plain} would still be quicker/nicer than nothing). This cake is no lie. $;^ J

    I see {code}{/code} tags used in the Programming forum (and Advanced forum) plenty -- and when they're not, newbies are often instructed to start using them to preserve their indentation (although I believe I see less of this instructing these days, unfortunately). Still, as brushed upon in my first post, the {code} block could also get a button on the toolbar; I merely intended to make that its own topic once this one picked up speed (enter my surprise here).

    How would a new inline code tag be used as unintended? (Also, would it be detrimental?)
     
  5. 2Dcube

    2Dcube Member

    Joined:
    Jun 23, 2016
    Posts:
    382
    You're right, I hadn't read your post well the first time (to be honest I found it a little confusing).
    I suppose it might not be detrimental. I don't know if it would be used much by most people but it wouldn't hurt to add.
    That said, the admins here have to weigh carefully what to add as to not clutter things too much, so it's up to them I think.

    In regards to
    7. Choose whatever button icon thingy you like.
    I think it should be something that is fairly clear about what it does.
     
    Last edited: Oct 10, 2019
    ParodyKnaveBob likes this.
  6. kraifpatrik

    kraifpatrik Member

    Joined:
    Jun 23, 2016
    Posts:
    132
    The first post makes me feel so dumb. I'm not a native english speaker so I had to go through it multiple times and I'm still not sure if I understand it correctly. Is the entire point of this lengthy post that you would like to have a "code" button in the WYSIWYG editor? If yes, then I think it would be handy, as well as adding a missing "slicethrough text" button and a "spoiler" button.
     
  7. 2Dcube

    2Dcube Member

    Joined:
    Jun 23, 2016
    Posts:
    382
    I think that's what it is, but he doesn't like that current [ code ] tags break up the post if you just want to highlight a few words within your sentence.
    Just highlighting with bold or color isn't helpful because typing [ i ] makes your text italic.
    Correct me if I got that wrong.

    Off topic but how does 13 round up a list more nicely than 12??
     
    ParodyKnaveBob likes this.
  8. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,464
    Yeah having the [ic] [/ic] bbcodes would be great. 1 up for that!
     
    ParodyKnaveBob likes this.
  9. ParodyKnaveBob

    ParodyKnaveBob The Laughing Rogue

    Joined:
    Jun 23, 2016
    Posts:
    537
    I'm sorry my initial post brought confusion. $:^ ( I've worked for years to communicate more clearly, but I still .. don't sometimes.

    The point of the post is not to get a code button on the WYSIWYG editor. All three features you mentioned -- Code, Strike-through, and Spoiler, plus Quote which you didn't mention -- are already in the toolbar, but they're hidden under the Insert... dropdown button. However, as a side note, yes, I hinted that having Insert Code directly on the toolbar would be helpful.​

    The point of the post is to add a new feature for inline code, perhaps via a new ic BB Code keyword, plus a button on the toolbar (even if it must be hidden under Insert... although hidden means not found, not used). Although plain exists, it's not on the toolbar, and it's easy to misremember it because other similar code exists, too. And then, if ic (or whatever keyword) does get added, it would be easy enough to also let it highlight text in a similar manner as code blocks.

    But of course. I tend to break up walls of serious with flecks of amusement. $;^ }

    $X^ D
     
    kraifpatrik likes this.
  10. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,881
    I remember people wanting back the Dislike button when the forum migrated to the current SW, but it was rejected because it could only be done with a plugin, and essentially Yoyo's new owners won't allow any because they're a security risk. I would imagine a change like this would be a similar situation.

    I mostly write my inline code in GM, and then paste it as an image. It has the additional benefit that lazy people can't just copypaste it, but needs to actually type it out, helping understanding.
    upload_2019-10-11_17-58-39.png
     
  11. ParodyKnaveBob

    ParodyKnaveBob The Laughing Rogue

    Joined:
    Jun 23, 2016
    Posts:
    537
    Thank you for the security concern, Yal...
    ...but as I demonstrated in my first post, it's not similar at all. I linked the XenForo instruction manual's page that discusses adding custom BB Code, and then I outlined the exact steps it would take to do it. Neither plug-in nor PHP required. An admin would merely use the built-in manager to make it happen. Don't forget that we have custom emoticons an admin added, such as :potato: and :squirrel:; press the Smilies button on the toolbar, and you'll see there's a tab explicitly labeled Custom GMC Emoticons.

    That looks a lot more like a code block than inline code. Despite being hidden on the toolbar, we have code blocks available already. My request concerns text written right in the middle of sentences.

    I hope this helps to clarify,
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice