I deleted my earlier post because I suggested using <center></center>
. I saw that has been deprecated. The following works for me:
-
Create and activate a css snippet:
/*style to center text; activated by <p class="center">text</p> */ .center { text-align: center; }
-
Create a Templater (a Community plugin) template by opening a new Note, and typing the following as the Note’s content:
<p class="center"><% tp.file.selection ( ) %></p>
Choose a title for the Note like “center text.” This is “your template.” -
Move “your template” into your Templater folder.
-
Then, to center text: (a) select all the text that you want to center; and (b) open the Command pallet (⌘ P), find and click on “Templater: Insert Template,” © click on “your template” from the pop up (you can set up a hotkey for this). All the text you selected should then be centered.
-
You might have to quit/restart Obsidian to get this all to work.