Previous Entry Share Next Entry
Should newlines be automatic?
device
jducoeur wrote in querki_project
Now that I'm done with the enormous QL Stuff series, I'm going to let myself muse more here. Here's the question that has arisen today: should List items always render on separate lines in the resulting Wikitext?

I found the "problem" today when I was writing the previous post. When I actually put this into Querki:
[[Items -> ""¶* [[Description]] (____)""]]
, the results come out like this:
  • A shiny chime (Bell)

  • A musty tome (Book)

  • A bright flame (Candle)

That's okay, but the spacing seemed kind of excessive. Poking at the HTML, I found that there were <p> tags around each list item. That was weird -- it's what happens when the wikitext is double-spaced, implying that the output of the QL Expression was like this:
* A shiny chime (Bell)

* A musty tome (Book)

* A bright flame (Candle)
with a completely blank line between each entry.

So wait a second -- what happens if I *remove* the fancy ¶ sigil from the QL? I get this:
  • A shiny chime (Bell)
  • A musty tome (Book)
  • A bright flame (Candle)
Which is, of course, what I want -- but I hadn't said to put each item on a new line, so WTF? How is the bullet list actually working? There are clearly extra newlines being inserted somehow.

I spent a while hunting around the code, and finally found it: the renderer for Lists (which I wrote *ages* ago -- a whole eight weeks ago!) was automatically inserting a newline between each list item. That wasn't what I was now expecting, so I went to fix it -- and then paused to consider.

Here's the question: do we *want* to always include a newline between each List item? My original assumption had been no, because occasionally you *do* want to show a whole list on one line. But the thing is, QText (the Wikitext language, based on Markdown) is really smart -- if the next line just contains ordinary text, it will just get flowed together in the final output. It only becomes a new block if it starts with one of the magic Wikitext sigils -- something like "*" (bullet list), "#" (header), and so on. And really, the end result is kind of lovely: it means that bullet lists just *work*, and most cases where one would care about using ¶ aren't necessary.

The downside is, of course, that those newlines will be automatic, and there might be some edge cases where you don't want them -- mostly when you're actually trying to render something in-line that would become one of those magic Wikitext sigils. That said, I'm not coming up with any examples offhand that seems likely to be real *and* would have problems: the Markdown syntax is fairly resistant to these edge cases.

I'm still chewing on it, and opinions one way or t'other are welcomed. But in the interests of Querki's "the common cases should Just Work" philosophy, I am currently leaning towards calling this bug a feature, and pretending that I intended it to do that way all along...
Tags:

  • 1
(Deleted comment)
(Deleted comment)
Amusing, although not *entirely* astonishing. Basically, it means that the app is responding in an idiosyncratic way to:
<li><p>Here's some stuff</p></li>
which is the actual HTML. Having a p tag inside of an li tag is unusual, but it's not *that* unusual, and shouldn't provoke that response.

I'm honestly unsure whether the app's rendering is even a legal interpretation -- my suspicion is that it violates the standards -- but it's useful to know that it happens. That's at least a small argument for the more compact and conventional representation...

(Deleted comment)
Huh. That's less forgiveable -- it implies that something is very wrong with their handling of blockquotes...

(Deleted comment)
Anecdatum: In MS Word, if you type a line beginning with "*", when you hit enter, it automatically converts it to a bulleted list. Which is great. BUT -- it seems to arbitrarily decide what sort of spacing should exist between entries of that list, sometimes producing neat compact lists, and sometimes wasting lots of space like your first example. Bugs the heck out of me.

Yeah, I've seen that, and I'm hoping not to repeat that sort of mistake. I want Querki's behaviour to be consistent, and as intuitively predictable as possible. That's really why I'm leaning towards leaving the current behaviour in place -- I think it's what the user is likely to expect, most of the time.

But this question has put another feature on my to-do list: I want a way to display the Wikitext for a query/page, so that when something strange happens, I can quickly figure out why. You're starting with QLText, and you wind up with HTML, but the Wikitext is the step in-between. Sometimes, you need visibility into that...

I lean towards automatic, sating the 95% of use cases, and not needing the sigil. Make some extra syntax or steps for the exception case, not the other way around.

  • 1
?

Log in

No account? Create an account