Extra spaces within text

AI-generated summary

In a Support category discussion titled ‘Extra spaces within text’, user Steve_Walmsley asked how to preserve multiple spaces between words in Discourse without changing the font or using images that disappear upon editing. He explained his need to format a game after-action report for better readability.

User chapoi initially suggested using word-spacing: 1em; CSS, while Moin proposed converting the data into a Markdown table. ToddZ then provided a robust solution using a custom wrapper tag combined with CSS. By wrapping the text in [wrap=game-report]...[/wrap] and applying the rule [data-wrap="game-report"] { word-spacing: 1em; }, the spacing is preserved persistently without altering the font.

Steve_Walmsley confirmed this was the ideal solution he had independently discovered, noting his background in C++/C# and his intention to learn markup and CSS properly. He also mentioned programming his game to generate Markdown tables as an alternative. The discussion concluded with ToddZ sharing a link to a Discourse Meta guide on making custom CSS changes, which Steve_Walmsley bookmarked for future learning.

For formatting reasons, I would like to add extra spaces between words. Discourse normally removes these spaces, but sometimes it improves readability. I can use backticks, but that changes the font. I can use imagebut that vanishes the next time I edit the text.

Is there a way to add extra spaces between words and keep it persistent, without changing font?

word-spacing: 1em;

results in:

Don’t know why you would want it though :winking_face_with_tongue:

I am writing an after action report in a game. The report includes minerals present on a planet, with their accessibility. This is how it looks in Word (screenshot).

This is how it looks in Discourse.

Earth Survey Report

Duranium: 374,100 1.00

Neutronium: 121,600 0.60

Corbomite: 148,400 0.90

Tritanium: 183,700 0.70

Boronide: 146,400 0.90

Mercassium: 124,500 0.80

Vendarite: 125,600 0.70

Sorium: 166,700 0.80

Uridium: 105,200 0.70

Corundium: 275,000 0.70

Gallicite: 406,000 0.90

I can remove the extra lines, but it is more readable with spaces between the numbers.

Ah okay you meant in the composer specifically, so you can choose when and where to add them?

What about a table?

Earth Survey Report

Material Value Modifier
Duranium 374,100 1.00
Neutronium 121,600 0.60
Corbomite 148,400 0.90
Tritanium 183,700 0.70
Boronide 146,400 0.90
Mercassium 124,500 0.80
Vendarite 125,600 0.70
Sorium 166,700 0.80
Uridium 105,200 0.70
Corundium 275,000 0.70
Gallicite 406,000 0.90

If you don’t use backticks for anything else, you could just overrule the CSS for them.

Might be the easiest way.

You could also put a named wrap around your report and apply CSS to that:

I find this easiest in the Markdown composer:

[wrap=game-report]

Duranium: 374,100 1.00

Neutronium: 121,600 0.60

Corbomite: 148,400 0.90

...etc.

[/wrap]

Add your custom CSS:

[data-wrap="game-report"] {
    word-spacing: 1em;
}

Result:

Yes, I independently arrived at this solution before I came back here. Much better for what I need. Thanks.

I really need to start learning markup properly. My background is C++/C# etc.

And I just programmed the game to generate the survey data including the table markdown, as an option :slight_smile:

Thanks, this is also an interesting solution. I have no experience with CSS at all. Something else I need to learn :slight_smile:

Making custom CSS changes on your site is a nice primer & walkthrough.

Thanks - that looks very interesting. I’ve bookmarked and I will spend some time on it.