Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
textile text alignments
At the moment, and since the beginning textile translated text alignments such as p>.
with inline css. ie <p style="text-align:right;">...</p>
. I think that conflicts with the separation of content from style.
I was wondering if it is prudent to change that to a class such as <p class="align-right;">...</p>
, and what would the problems be if an additional class is required by the author such as p(my-class)>.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: textile text alignments
I think <p align="right">…</p>
would break style from content separation principle, not <p style="text-align:right">…</p>
.
<p class="spec-style">…</p>
requires a corresponding item in an external style sheet or in a header of the webpage. Not always desirable. And also, the class should be named semantically, not visually. Anyway, you can always mark p(spec-style).
instead of p>.
.
Last edited by Vienuolis (2025-01-24 19:50:56)
Offline
Re: textile text alignments
Yeah, it is a bit of a conundrum. Specifying p>. Text ranged right
is, I guess, the author already adding styling to the content, so concerns are already getting mixed from the beginning. Each of the options has their pros and cons:
<p style="text-align: right;">Text ranged right</p>
works in all browsers. However, if you set CSP rules for your site and do not includeunsafe-inline
among your directives, it will be disallowed.<p align="right">Text ranged right</p>
might survive CSP (?) in that it is not open to misuse/abuse for other purposes, but as far as I can tell that attribute is deprecated from HTML (source), so its days seem numbered.<p class="text-right">Text ranged right</p>
would be safest but requires that your css styles include a correspondingly named helper class (e.g. as per tailwind). Without it, you do not get the desired result.
For now, if you want to be safe, Vienuolis’s suggestion of deliberately specifying a class name and then including that in your style would seem to be most future-proof.
EDIT: Added w3.org source for deprecation of align attribute.
TXP Builders – finely-crafted code, design and txp
Offline
Re: textile text alignments
I can’t remember ever using those Textile alignment markers, personally.
Having a class in your stylesheet specifically for that purpose is rather evident and part of basic building blocks of your layout.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: textile text alignments
So, would be this a good time to deprecate the alignments as they just produce in-line styles?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: textile text alignments
In-line styling is not deprecated by W3.org, nor is text-aligning. Inline styling is sometimes more convenient and cleaner. It is up to the designer to decide which method is more appropriate in a given situation: what to describe in an external style-sheet, what in a header, and where by a singular inline style.
Offline
Re: textile text alignments
Vienuolis wrote #338881:
In-line styling is not deprecated by W3.org, nor is text-aligning. Inline styling is sometimes more convenient and cleaner. It is up to the designer to decide which method is more appropriate in a given situation: what to describe in an external style-sheet, what in a header, and where by a singular inline style.
The align
attribute is deprecated in HTML 5 (see MDN, developer.mozilla.org/en-US/docs/Web/HTML/Attributes), or the HTML Validator on this test. It still works in browsers, of course.
The style
attribute is a perfectly valid replacement, although it is more versatil to use a class
referenced in a/the stylesheet.
I don’t see what would need on change in Textile, personally.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: textile text alignments
phiw13 wrote #338882:
I don’t see what would need on change in Textile, personally.
Maybe not much, all that it will be needed is to depredate the inline styles. For backward compatibility (for existing sites) p>.
could be parsed as <p class="text-right">
so that site owners would just need to add .text-right {text-align:right;}
in their stylesheets. This of course should also be the case for p=.
and p<>.
that should also receive their equivalent treatments.
I’m not sure what happens with right to left text as p<.
is currently the default in textile.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: textile text alignments
Vienuolis wrote #338881:
In-line styling is not deprecated by W3.org, nor is text-aligning. Inline styling is sometimes more convenient and cleaner. It is up to the designer to decide which method is more appropriate in a given situation: what to describe in an external style-sheet, what in a header, and where by a singular inline style.
text-align is indeed not deprecated developer.mozilla.org/en-US/docs/Web/CSS/text-align
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: textile text alignments
Some crossed wires in this thread. I thought I differentiated clearly in my post but still it got conflated. Moving on …
colak wrote #338883:
I’m not sure what happens with right to left text as
p<.
is currently the default in textile.
CSS now provides for text-align: start;
and text-align: end;
(see also the tailwind example and can-i-use) as direction-agnostic specifications that switch depending on LTR and RTL text directions.
Of course the <
and >
brackets in textile can’t help but suggest a direction. FWIW: it looks like markdown has no alignment notation. The examples I find (from a cursory search) always involve adding html markup manually using either the align
or style
attributes.
—-
Regarding textile in general, there are various textile notations that are not wrong but are also outdated (e.g. !image.jpg!
can’t produce an image or figure tag with a srcset).
Deprecating and then later removing support has backwards compatibility problems. A long time ago there was the idea of textplugs as a means of modifying / adding to textile behaviour. That might offer a way of rewriting, for example, p>. Reverse aligned text
to <p class="text-align: end;">Reverse aligned text</p>
(leaving aside for now the potentially contentious assumption that right bracket = align to end), and so provide a means of converting (old) textile notation to newer output. At present, you can use a textpattern plugin to post-process the body/excerpt field on save, but that doesn’t help with the bulk re-textiling of old articles.
TXP Builders – finely-crafted code, design and txp
Offline
Re: textile text alignments
colak wrote #338883:
I’m not sure what happens with right to left text as
p<.
is currently the default in textile.
RTL languages will actually do the correct thing, assuming the HTML is reasonable well set up. Either you have full page RTL language, you specify the dir=RTL
attribute on the root element, or you have RTL text inside a left-to-right page, then you wrap your RTL block in div
or similar container, and specify the dir=RTL
on that element (and for good measure you specify the relevant lang
attribute too).
Then p.
(no alignment modifier) will output right-aligned text – by magic of the dir
attribute. p>.
will still produce right-aligned text, and p<.
left-aligned text.
jakob wrote #338885:
Some crossed wires in this thread. I thought I differentiated clearly in my post but still it got conflated. Moving on …
Sorry I hadn’t seen you post.
PS – and yes, ideally, as slightly suggested by Jakob, the output of those alignment modifiers would be p style=text-align: start
or end
. (Of course, that would, in my example above, give different results though).
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline