pretext icon indicating copy to clipboard operation
pretext copied to clipboard

visible whitespace in pre and cd

Open Alex-Jordan opened this issue 3 years ago • 5 comments

Look into what we might do to make spaces (and tabs?) visible in pre and cd output.

Always visible? Publisher choice? Attribute on the pre or cd?

Only applies to space characters when leading or trailing?

Alex-Jordan avatar Mar 23 '22 23:03 Alex-Jordan

And c too. @davidfarmer suggests marking each space with span.space for the presentation in HTML output.

We can have an attribute like @showspaces with values like no, all, leading, trailing, leading-trailing, etc.

I think an author needs to say/decide where they are critical/important. So not a publisher option?

rbeezer avatar Mar 24 '22 00:03 rbeezer

Some Googling: http://jsfiddle.net/qrxLj/

In that example, js is replacing each space character with a span. We could do that or we could do XSLT text manipulation to write the span.

Something to keep in mind (maybe). Once, long long ago, PreTeXt made the decision that its pre was supposed to be like verbatim. That is not really what HTML pre does. HTML pre allows for tags inside like <b> for bold. It would be like if PTX source allowed:

<pre>
This is <em>emphasized</em>.
</pre>

Maybe that doesn't matter, but when I started thinking about having spans inside our HTML pre output, it reminded me of this difference.

Alex-Jordan avatar Mar 24 '22 00:03 Alex-Jordan

Maybe a good default is to show leading space?

That would also let authors know there are options.

davidfarmer avatar Mar 24 '22 00:03 davidfarmer

js is replacing each space character

We don't get JS in EPUB. :-(

rbeezer avatar Mar 24 '22 01:03 rbeezer

We don't get JS in EPUB. :-(

But we can still do XSLT text manipulation to write the span? Or do we not want to do text manipulation like that in pretext-html?

Alex-Jordan avatar Apr 01 '22 23:04 Alex-Jordan