Camen Design Forum

What convetion should be used for code and quote bbcode?

append delete Kroc

The reason I haven't implemented pre / code and quote bbcode yet is that I’m undecided on what convention I should use. I would not like to use a convention that requires typing a symbol every line, as this goes wonky and becomes difficult to manage if you delete / add text before submitting. Therefore, some sort of enclosing wrapper would be best.

Quotes:

It is important to note that quotes will have to contain nested quotes, so the syntax has to be such that this can be safely detected and rendered.

The most common type of quote convention is "[q]…[/q]". These are okay, but nothing too special. In ReMarkable, block quotes use pipes and tabs—off the cards here—but inline quotes use « … » or << … >>. These look nicer but are less commonly known.

PRE / Code:

There is a need to quote source code and other monospace text. In bbcode this is usually [code]. In ReMarkable it is `…` (samp) or ``…`` (code), and the pre "fence" for large blocks.

~~~>
…
<~~~

Pre fences have the benefit of being nestable, however this is not common in bbcode; most bbcode does not allow you to write unescaped bbcode, other than turning the whole feature off.

I am interested mainly in elegance, simplicity to type (most bbcode is clumsy) and a natural flow in text.

What are your thoughts?

Reply RSS

Replies

append delete #1. JJ

I don't like bbcode. The question of blocks is a good one. The markdown way of doing PRE would be a bit impractical in a textarea where the user will most likely not be able to tab large groups of lines, or tab at all for that matter. The Remarkable way seems more user-friendly, but still kind of akward. I've been thinking maybe use something even simpler, something like the Python comment syntax e.g.

"""
code here
"""

Obviously, might make it hard to post Python code if there are block comments in it though. Maybe it's more intuitive for that style to be for block quotes though.

Maybe:

###
coffeescript style?
###

...for code and the triple double quotes for blockquotes?

append delete #2. Kroc

Quote blocks cannot nest unless the beginning and end delimiters are different from each other.

Actually, I hadn’t thought about this in depth enough. I have just realised that given that the quote delimiters would not be shown in the user's post, people copy / pasting text would not be able to nest quotes unless they re-typed in the delimiters themselves. Therefore quotes would not need to be nestable.

In this case, my personal preference would be tilde fences

~~~
quote
~~~

This has been used here before and seems to be clear and obvious.

However, I could design a quote so that its delimiters do (naturally) occur in the output text, so that when users copy / paste the text, they get the quote code back. This could be done with guillemots:

«the quick brown fox»

Which would act as both the delimiters as well as the output.

If we use "~~~" as quote, what about code? Perhaps we could go one simpler here and just have a combined quote / code block. Anything between the tilde fences is shown monospace, and we could just re purpose this as a rudimentary way to quote people too.

append delete #3. theraje

Yeah, really there doesn't *need* to be a difference between the CODE and QUOTE markers. Either way, they'll both be placed in a rectangular area... the only difference is usually the font formatting. Font formatting shouldn't be that big a deal -- either way, you get the point across with the text box.

append delete #4. Jonhoo

The problem with using "«" and "»" is that they are rather difficult to type on PC keyboards (at least I don't know any shortcuts for them). The tilde character is better, but still a bit of a hassle (especially for non-US layouts).

I like the idea about Python docstring syntax as it is simple and fast to type.
As mentioned though, it doesn't nest, and sometimes you'd want to include nested quotes in your text.
How about a combination?
"""
Quote goes here
;;;

%%%
Code goes here
;;;

The exact characters could be decided later, but you could at least use the same end tag for all blocks to make it easier to remember.

Inline quotes could just use "quote here" for instance, and inline code could use the LaTeX Math syntax of $code here$

append delete #5. Kroc

That's not very friendly. These forums shouldn't be just for geeks who understand syntax, and multiple forms of it. I think theraje is on the right track, that it doesn't matter the difference between code and quote, the fact it stands out will do the job. The syntax should be simple. If tildes are not always available on keyboards, then what about "---".

Remember, I have to somehow fit in documentation for all this in the design, and I want to take up as little space as possible :P

append delete #6. JJ

Hmm, are nested blockquotes and PREs really necessary? Speaking as a user, I would be comfortable with a lack of nested quotes/pre's as long as it provides simple/convenient syntax.

append delete #7. Jose Pedro Arvela

Regarding nesting:
It might be of simply not having noticed so far, but I haven't seen so far any case of code needing to be nested. Code tags inside code tags might happen, but they don't seem useful for me (furthermore, I'd actually disable any conventions inside code tags, with perhaps only linkification being kept, but without converting the text inside as it happen outside).

Quotes are completely different from code blocks. Quoting from these forums themselves could mean having other quotes inside quotes, and these quotes might be necessary for context. In this case, I think it is necessary to have nestable quotes.

So, my idea for syntax is that it should be intuitive. Inline quotes could use "quote here", being able to nest only up to 1 level of quotes by doing "quote 'quote of quote'" (having more than 1 level of inline quoting would be messy). It seems to me that this kind of syntax is intuitive and straightforward.

Block level quotes are more doubtful. Having a non-English keyboard, I have
«Quote»
accessible and usable (although it is not common to use it where I live). But if that is not understood, perhaps
<Quote>
or
<<Quote>>
could be used.

Code is more difficult because there is no single thing that says "I am code!" What I see working perhaps, would be a certain number of cardinal signs. Like so:
###
Code
###
This is because cardinal signs seem to me to have always been related to more technical topics.

append delete #8. JJ

Hmmm, I'm still leaning toward simplicity for my vote. Maybe just don't worry about nested quotes/pres. It will even make the regexes faster and simpler. I can't imagine anyone complaining harshly about not being able to nest quotes.

However, if we really wanted to be intuitive about this, it could be possible to have the start of a blockquote be a line feed and a double quote, and the end be a double quote and a line feed:

"Start parent quote

"Nested quote here"

End of parent quote"

That should allow for nested blockquotes, and be fairly intuitive as well. It also for the most part wouldn't interfere with "inline quotes like this one".

append delete #9. Kroc

Exactly what I was thinking JJ :)

Vote!? This is not a democracy! >:] Everybody’s input is taken and fed through my brain and what comes out might not be what you were asking for, but your ideas will be considered and help shape the final result.

append delete #10. JJ

Yeah, I realize were not doing a show of hands here. That was just my conceptual vote.

append delete #11. Jonhoo

My conceptual vote goes to JJ's suggestion as well ;)
In fact, this could be extended to work for code as well...
Only since it doesn't have to nest, we can use the start-end on it's own line (looks better)
$
#!/bin/bash
echo Hello world
exit 0;
$

append delete #12. Kroc

I’ll implement JJs quoting stlye when I next have time and I will think about the code issue.

append delete #13. Kroc

The whole design of the bbcode eventually used must be such that it doesn’t cause people to nag for a preview function. I want to avoid that. It’s one of the very things so wrong with current forums.

#14. Kroc

This post was deleted by its owner

#15. Kroc

This post was deleted by its owner

#16. Kroc

This post was deleted by its owner

append delete #17. Kroc

That should allow for nested blockquotes, and be fairly intuitive as well. It also for the most part wouldn't interfere with "inline quotes like this one".

Quite right.

(Had a few failed attempts there :P)

append delete #18. theraje

"""
i can has cheezburger?
"""
No.

append delete #19. Jose Pedro Arvela

The whole design of the bbcode eventually used must be such that it doesn’t cause people to nag for a preview function. I want to avoid that. It’s one of the very things so wrong with current forums.

That is incredible! :D

append delete #20. Jose Pedro Arvela

Question, does it allow nested block quotes? Who am I kidding? I'm testing it myself! :D

Test:
'The whole design of the bbcode eventually used must be such that it doesn’t cause people to nag for a preview function. I want to avoid that. It’s one of the very things so wrong with current forums.'

That is incredible! :D

append delete #21. theraje

Let's try this again...

How many therajes does it take to screw in a lightbulb?

0.35

#22. Jose Pedro Arvela

This post was deleted by its owner

append delete #23. Jose Pedro Arvela

This is incredibly awesome, and just to test it one more time, I'm quoting here Kroc's tweet with the incredible regexp he used:

Just for reference, here's the corrected code: /(?:^\n|\A)(?:(")|(“)|(«))((?>.|"(?4)"|“(?4)”|«(?4)»)*?)(?(1)"|(?(2)”|»))(?:\n$|\Z)/msiu

append delete #24. Kroc

There is a visual bug I have just noticed when a quote is the last thing in a post. I will work on that.

Quoting also supports nesting:

This is incredibly awesome, and just to test it one more time, I'm quoting here Kroc's tweet with the incredible regexp he used:

Just for reference, here's the corrected code: /(?:^\n|\A)(?:(")|(“)|(«))((?>.|"(?4)"|“(?4)”|«(?4)»)*?)(?(1)"|(?(2)”|»))(?:\n$|\Z)/msiu

I think I should include the quote speech marks (styled differently) so that when you copy / paste someone else's quote, it retains the nesting.

append delete #25. JJ

Ahh, now I miss real regexes. Damn javascript.

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn