A user, orangeandblack5, is trying to indent a paragraph of text using HTML and CSS, but the style attribute is not being whitelisted by Discourse. seanblue suggests that the style attribute is blocked for security reasons.
Several users offer alternative solutions, including using   to indent the first line of a paragraph, wrapping the text in <ul> tags, or creating a custom bbcode using the wrap attribute.
Steven provides a solution by adding a custom CSS rule to the theme and using the [wrap="indent"] bbcode to indent the paragraph. Canapin asks about the differences between this solution and using spans with a data-theme attribute.
The discussion also touches on customizing post styles and adding icons to the toolbar. Steven shares a theme-component that allows adding custom icons to the toolbar or gear menu.
I feel like and idiot but I can’t for the life of me figure out why this isn’t working:
<div style="margin-left: 20px">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
Gives the following:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Which is notably not indented!
Surely there must be some way to support text indentation, even if it’s non-obvious for whatever reason, right?
Edit: I had got confused with adding four spaces to a new paragraph in a list item to keep that aligned.
I did discover that you can wrap a block of text in <ul> </ul> and that indents it. It’s a bit hacky though, but may be useful if you don’t have access to the admin settings to create the wrap solution from further down.
Eg.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
I don’t see anything in site settings, but maybe you could with a plugin. I found two files mentioning HTML tags that might be useful to look at. Personally I think it would be dangerous to whitelist the style attribute though.
I believe div style is not whitelisted, you would need a plugin or component. But you can create a wrap bbcode directly in your admin forum. Add these lines in Customize > your theme or component > CSS Common
[data-wrap="indent"] {
margin-left: 20px;
}
Then in your post, use this for the text you want:
Since we use the div element, we can customize a bit much, but for inline styles, your option is the best imo.
I’m not sure if there’re a lot more options out of the bat. When I use something often, I go with a plugin or component to create a div class or bbcode and add an icon in the toolbar.