In HAML I often want to use a tag with punctuation following immediately after the tag. For example, I might want to put something in bold but have a closing bracket. The formatting would look like this: (Example sentence with bold text.)
Note that the 'bold text' is in bold but the period and closing bracket '.)' are not.
The obvious HAML is like this:
(Example sentence with
%span.important bold text
\.)
but this causes an extra space between 'bold text' and '.)'. Here's one way of doing it instead:
(Example sentence with
%span.important bold text
%span>\.)
Where enclosing the '.)' in a span with >
makes the space disappear. However, this requires an unnecessary span.
Is there any way of getting the desired output, without the extra span?
That initial code snippet shouldn't work in HAML at all:
(Example sentence with
%b bold text
.)
The third line would result in an Illegal element: classes and ids must have values
error. It should be:
(Example sentence with
%b bold text
\.)
However, that just fixes the code error. It still displays the way you're complaining about. I only know of two ways to address it:
(Example sentence with <b>bold text</b>.)
:markdown (Example sentence with **bold text**.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With