Discourse Annoyances

Graz, Dunno if anything can be done? but these things are really T-ing me off!

  1. New Users almost NEVER format code blocks.

Often it is worse-than-bad because half way through their code it is naturally indented and the stupid MarkDown treats that as code, or sees a "*" in the code as an Italic / Boldface instruction etc. etc. Users moan that they cannot post because all the @Variables in their code are seen as @UserName alerts (.e. Newbies don't have enough REP to post with @UserName notifications)

my thought would be to add a message on the Reply window saying "Please format any CODE blocks using the </> button and choose a Category"

(Or may category compulsory if that is possible?)

  1. Emails to users alerting them to a reply contain the text from the thread. I think that reduces the chance that they return but, more importantly for me, I re-edit a high percentage of my replies (because I'm dyslexic I don't see typos on proof reading and its the display-back, formatted to different width etc, where I often see a mistake). I'd prefer the O/P didn't get a copy of my earlier "draft" by email 'coz chance are they won't bother to read the corrected version when they come back.

  2. Using the [CODE] tag to format code leaves out all blank lines (the Toolbar Button works OK, but I find it easier to use the old fashioned [CODE] tag because I can just Cut&Paste in an example without it getting reformatted with leading spaces which then makes any corrections a nightmare.)

It seems the Authors took (a very strong) view that CODE does not need any formatting within it. I seriously miss that because on old forum I used to use [COLOUR] or [BOLD] etc. to highlight bits of the code that I wanted to draw to the user's attention, now all I can do is

something = something
somethingelse = ChangedByMe -- ***** I CHANGED THIS LINE ***
someotherthing = someotherthing

which leaves me, and everyone else, having to carefully compare the line to see what was actually different!

3 Likes

I concur with all of @Kristen 's comments, although the e-mail thing doesn't bother me as much (probably because I am less diligent than Kristen about revising posts for accuracy). In particular the inability to bold or highlight parts of text that have been formatted as code is really a handicap.

Another thing that I have not been able to figure out is the numbering scheme. Case in point - Kristen's post that started this thread. I would bet that he meant to number the items 1, 2, 3 but it ended up being 1,1, 2 because he needed to break up the first item into paragraphs.

I've been looking at changing the text to give better instructions on indenting code. I haven't found a good way to do that yet. I'll keep looking though.

On the emails, I'm not sure what to do about that. It's usually a good thing for them. But I see why it doesn't work for you. I'm not sure what to suggest.

I just use Control-K to format my code. I've never tried to format anything inside there.

Test1
**Test2**
Test3

Hmmm. It doesn't work. I certainly see the point of that. Let me do a little research on this one.

Yes, I agree, sorry I wasn't clearer on that point, My thought was that it would be better if the email said "A reply has been posted to your thread, CLICK HERE to read it" rather than "Here's a copy of the reply that was posted ..." :smile:

I didn't type what was in my mind!!! What I said was:

What I meant was! to put some additional instructions on the New Thread Create form

Reply pops up at the bottom of the page and there isn't a lot of room, plus waffle would pollute the page etc.

New Thread works in similar way (i.e. the pop-up) but it says "Create a new Topic" at the top and has additional form-fields for Subject and Category, so if you can "inject" some instructions into that form I don't think they would be in the way as (presumably?!) they would not also appear on a Reply Form.

aside: IF there was a way to detect "newbie" then addition comments for "Newbies can't post image links, or @UserName notifications" etc. might help. It wouldn't bother me, personally, if that info were there for all users on a New Thread Create - if that form took up the whole page I wouldn't mind - I don't suppose regulars create many new thread (well, I know that I do, but not the rest of you, eh?!)

I've been on a "forage" in Discourse.org looking for an answer / alternative ways:

I turned up some (to me at least!) interesting stuff:

There was chatter about "Fenced code blocks" and "Indent 4 spaces". Jeff Atwood said:

"I think it's better to have a site setting that switches the code button from

  • indent 4 spaces

to

  • fenced code blocks

Because on a site that is mostly about code, for programmers, you'd certainly want syntax highlighted code blocks almost all the time. And for sites that aren't for coders they almost never want syntax highlighted code blocks."

That seems to make a lot of sense - clearly, here, we could do with "fenced code blocks" - I didn't know what that was / that that existed until this morning.

There is also support for Language Code Formatting - again, 99% of the stuff here is SQL so ... same applies I reckon. And guess what ... it works!

SELECT Col1 FROM MyTable WHERE Col2 = 'Foo'

either it is auto-detecting the language, or Graz chose "SQL" during the install :smile: (EDIT: I read that there is a default code lang site setting so @graz might be worth setting that if not already)

Syntax for a fenced-code-block uses triple-backticks like this:

```
    SELECT Col1 FROM MyTable WHERE Col2 = 'Foo'
```

Note that the triple-backtick is NOT indented. The code does NOT need to be indented 4 spaces - yeah! so its a drop-in replacement for [CODE] tag

I don't know whether there is a setting that could make 4-space indenting (and/or the Control-K / [</>] button methods) default to syntax highlighting.

Here's the thread on Discourse

By the by, I personally detest the Markdown indent-4-spaces method (which is what you get if you presss COntrol-K / click on [</>] ). It means when the recipient cuts & pastes they have four spaces on the front of everything - blank lines included. Whereas if I use

[code]
[tab]SELECT
[/code]

then that is EXACTLY what Copy&Paste will give the recipient.... but [CODE] is broken in a number of ways - e.g. it does not include any blanks lines. Here is a [CODE] block with a pair of SELECTs, indented with TAB and with a blank line (which is not displayed) between them

[code]
[tab]SELECT 1
[empty line]
[tab]SELECT 2
[/code]

gives:

	SELECT 1

	SELECT 2

well that's weird - its even more broken than I thought! SELECT-1 is indented with a TAB, the blank line is missing BUT the SELECT-2 line is indented with 4 spaces <sigh>. If I add a TAB to the blank line between them that line still doesn't show ... but the SELECT 2 tab's up correctly

Here's the same again with the blank line containing a single tab

[code]
[tab]SELECT 3
[tab]
[tab]SELECT 4
[/code]

gives:

	SELECT 3
	
	SELECT 4

aside: <code> tag is also available but is differently broken to using [code]

<code>
[tab]SELECT 3
[tab]
[tab]SELECT 4
</code>

gives:

SELECT 3
SELECT 4
<sigh!>

Ah ... SUCCESS I THINK ... sorry, written sequentially as I researched it, but I then found that triple-backtick IS the answer to the problem. Just use that INSTEAD of [code]

```
[tab]SELECT Col1 FROM MyTable WHERE Col2 = 'Foo'
[empty line]
[tab]SELECT Col2 FROM MyTable WHERE Col1 = 'Bar'
'```

gives:

	SELECT Col1 FROM MyTable WHERE Col2 = 'Foo'

	SELECT Col2 FROM MyTable WHERE Col1 = 'Bar'

note that no additional indentation is required, Copy&Paste preserves the original TABs and blank lines exactly. Rest assured I'll be back if & when I find it is broken in some way, but I'm a happy camper now :smile:

Question: Am I OCD enough to go back and re-edit every post I have made to change [CODE] to ```? :sunglasses: (its rhetorical, I'd prefer you did not answer "YES" :smiley:)

Still researching - @graz I like the look of this setting from this thread on Discourse.org too please :smile:


"Now the button AND the bbcode block work the way I wanted"

P.S. I didn't find out how to highlight WITHIN a Code Block ...

I appreciate this thread because I did not even realize there was a "Category" to set. Keep up the good work!

I see more being set by Graz then the original poster :frowning: between such category-less posts I can visualise Graz polishing his halo :smile:

There was talk in the early days about making Category compulsory, but from memory that was not an option that Graz could set.

Interesting. I'll look at setting syntax highlighting.

I looked at forcing a category. My fear is that people will just pick the first category. It's pretty easy to find the few without a category and update them. It's harder to figure out which ones are in the wrong category.

Very good points. You are clearly happy being gatekeeper for Categories, and as long as that is the case I think you have a good solution. I don't, naturally, spot where they are missing, otherwise I would add more and be able to polish my halo too :smile:

@graz Any chance we could do something about this? Its always pissed me off ... but I just wanted to let you know that a) its still pissing me off :slight_smile: and b) I'm still expecting you to wave a magic wand to make it go away :smile:

Dealing with a post like this one, which due to no-[CODE]-block and the way that Mark-Down latches onto any character in the normal flow of text that looks like it might be a formatting clue, royally screws up the post.

I see folk, much more kindly than me!, saying "Please use PoorSQL.com to format and use Control-K" but I haven't got the energy ... most people are posting once ... and their code probably doesn't need PoorSQL.com, its probably already reasonably indented, just that something somewhere between Mr Mark Down and Sir Tim Berners Lee is throwing all the good TABBing away :frowning:

On SQLCentral etc. I very rarely see code that is NOT formatted - not sure why that is? Same ignorant newbies posting questions there for sure ...

Here's an idea for a Cool Cat to write in JavaScript:

If thread contains SELECT, FROM and WHERE and does not contain either

    ``` or [CODE]

(I suppose it would also need to check for the stupid 4-space-thing) then pop up a message warning the user to use the [</>] button to format their code or Graz's Wrath will descend on them (of course the message needs a word that rhymes with Graz, "Wrath" won't do at all, but as you know I'm a Byslexic Dastard, so that's someone else's job to come up with the right phrase :slight_smile: )

Right then ... "Ready, Steady, Code" :slight_smile:

Kristen, how did you post this? The formatting didn't seem to work.

My ability to fix this hasn't changed much :smile:

I don't think I can attach JavaScript to a page. And I can't write it anyway.

I'm on vacation now but I'll try to remember to see about putting some better text in there.

Presume you mean my reply in that thread?

It looks OK to me, but perhaps I'm missing something?

Here's the exact content of my post


    [quote="gbritton, post:2, topic:3164"]
    SPACE(any length) = ''
    [/quote]
    
    I know that .. in fact I've known that since I was in short trousers ... :smile:
    
    So  WHY oh WHY oh WHY have I been writing this ALL THESE YEARS? :frowning: in order to convert a parameter from "blank" to "null"
    ```sql
    SELECT @MyParameter = NullIf(RTrim(@MyParameter), '')
    ```
    when quite clearly this would work just fine
    ```sql
    SELECT @MyParameter = NullIf(@MyParameter, '')
    ```
    How many RTrims have I typed unnecessarily? :frowning: :frowning: :frowning:
    
    One thing is for sure ... I'm not going to do it again!!

and here it is repeated so that it "formats"


I know that .. in fact I've known that since I was in short trousers ... :smile:

So WHY oh WHY oh WHY have I been writing this ALL THESE YEARS? :frowning: in order to convert a parameter from "blank" to "null"

SELECT @MyParameter = NullIf(RTrim(@MyParameter), '')

when quite clearly this would work just fine

SELECT @MyParameter = NullIf(@MyParameter, '')

How many RTrims have I typed unnecessarily? :frowning: :frowning: :frowning:

One thing is for sure ... I'm not going to do it again!!


Has that got anything to do with being on vaccination and drinking Tequila in the sunshine? :smile:
When I have a mo. I'll ask on Discourse and see if someone there has A Bright Idea.