Word Hyphenation

What I’m trying to do

I use justified text in preview mode. Because it sometimes looks awkward the way the words are spaced, i would like to enable proper word hyphenation at line breaks.

Things I have tried

Here is my css file

.markdown-preview-view p {
text-align: justify;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;

Hyphenation does not work. The words dont even break at all.

i also tried to include word-break:break-all; but that just makes the words break at completely wrong locations (e.g. it broke “to” into “t \n o”).
Is there any way to make it work properly? Thank you in advance.

1 Like

I tried the same and it didn’t work. As far as I understand the hyphens property requires the lang attribute to be set in the html file since the hyphenation rules differ for each language.

However, obsidian doesn’t use the lang attribute. As a consequence the hyphens property will not work.

It would be nice if Obsidian would support setting the lang attribute in the yaml frontmatter so that the language can be set for each note. But currently I see now way to make hyphenation work.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.