-2

I'm writing a story, When ever I'm done with a chapter I place it in a HTML file for fun. I've been using the paragraph tag for each paragraph. But I have a lot of paragraphs and there's a lot more to come. I'm here to ask if there's a easier way to do so. Willing to use css.

Dan
  • 25
  • 4

3 Answers3

3

This is not a programming question, but still, since I know the answer I am answering it. What you are looking for is, Markdown.

Markdown is a Wiki like syntax, specifically used for Rich Text Content. So now since you have an issue with writing too many paragraphs, Markdown makes it easy to convert all the double line breaks to paragraphs for you.

For eg., consider the below text:

Pages that you view in incognito tabs won’t stick around in your browser’s history, cookie store or search history after you’ve closed all of your incognito tabs. Any files that you download or bookmarks that you create will be kept.

Going incognito doesn’t hide your browsing from your employer, your internet service provider or the websites that you visit.

You can see that there are two line breaks after the word kept.. This will render in a browser, when you input the above text in a Markdown converter, this way:

<p>Pages that you view in incognito tabs won’t stick around in your browser’s history, cookie store or search history after you’ve closed all of your incognito tabs. Any files that you download or bookmarks that you create will be kept.</p>
<p>Going incognito doesn’t hide your browsing from your employer, your internet service provider or the websites that you visit.</p>
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
1

Depending on how picky you are about presentation, you may consider wrapping the entire thing in...

<div style="white-space: pre-wrap">
Epic story of epic unicorn epicness!
</div>

This will preserve all whitespace, not just newlines but also spaces between words. This means that if you have a large space in your text (conveying a pause through typography, or whatever) then you can just type a bunch of spaces and they will work.

However, you won't have the ability to control how much space there is between paragraphs, other than by adding more newlines. You can't make the space whatever size you want like you could with paragraphs. Consider what you need and choose a course of action.

Personally, I'd use Notepad++ (or a similar editor), and do a "Find and Replace" for all regex (.+) to be replaced with <p>\1<\/p>

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
0

You can use simple search and replace as Niet the Dark Absol has suggested. Depending upon your Notepad++ version, the replace may require $0 to refer to source match. (Here is a more discussion about it, Notepad++ Regex replace - \1 doesn't work?).

Here is how you can search for the paragraph and replace with a paragraph tag.

enter image description here

Result

enter image description here

Community
  • 1
  • 1
NotepadPlusPlus PRO
  • 987
  • 1
  • 8
  • 21