erincayaz / obsidian-colored-text

MIT License
70 stars 4 forks source link

Can't use bold, italic, etc. #20

Open DominicDevelop opened 11 months ago

DominicDevelop commented 11 months ago

As soon as I use a color, the text formats like bold or italic won't work anymore or I am using them wrong :(

erincayaz commented 11 months ago

Hi, I didn't think about this case. Because text is wrapped in HTML, Obsidian's way of making bold/italic is not working. You can add font weight to generated span temporarily: <span style="color:#ffff11; font-weight: bold">lorem ipsum</span> and I will try to figure out a way to make this more user friendly.

If you have any suggestion on this topic, feel free to share.

maread99 commented 10 months ago

Isn't the only (or at least easiest) way of doing this to store 'styles' rather than colors, with a style comprising:

The extra styling could perhaps be represented in the slot with 'B', 'I' or 'BI' characters appearing in the color square?

Thanks for the plugin!

erincayaz commented 10 months ago

@maread99 I was thinking of having 2 buttons on the status bar that represent Bold and Italic and by clicking the buttons user can activate bold and/or italic.

For storage, why did you suggest storing bold and italic for each square? I think that could be unnecessary because having one bold and italic option that affects all coloring can be enough.

Thank you for sharing!

maread99 commented 10 months ago

I was thinking of having 2 buttons on the status bar that represent Bold and Italic and by clicking the buttons user can activate bold and/or italic.

That would be grand.

I'm not sure what I was thinking!

Thanks again.

erincayaz commented 9 months ago

Hi, I made a new release that is covering this issue #27. Unfortunately, it is not fully functional yet, you need to be very precise for bold and italic to work but at least it gives a way to make the text bold/italic. Right now it only works with the shortcuts (Ctrl + B, Ctrl + I) and the whole text (including HTML elements) should be selected.

The other cases, such as wrapping colored text by hand, removing the color, and selecting more than one text with colored text in it are not covered yet. I want to implement those as well however it is hard to do, so I want to first give a way to make colored text bold, and italic until then.

Because of these I am not closing the issue, just wanted to give an update.

ansuhayda commented 1 week ago

Hello! I just installed your plugin and also noticed it removed any formatting such as bold, italics, etc. which led me to this topic. In your last comment, you said using hotkeys will work to format the text, but I found a bug with this. For bold, Ctrl + B, it sets the text to italics. I tried manually changing the word from italic to bold but this did not work. Just wanted to let you know. Thanks!