I am trying to make a simple blog, and I've got the backend and database parts down. I have two fields- one for the title and the other for the description. Currently, I'm saving these in a table without any markup. I think storing titles without any markup is okay as I can always render them in h2 tags when fetching from the database into the frontend. The problem is- I want to implement bold/italic/hyperlink-like features and I don't how to do it. I am not looking for code- I will do that on my own- just the approach I should take. I think I could change the textarea's content on button click and that should work. Should I be saving the HTML markup into the sql table or is there a better way? Thanks in advance :)
Here's rough example of what I will be doing if it helps.
boldButton.addEventListener(
'click',
() => {
textArea.value = '<b>'+ textArea.value + '</b>';
}
)