First, lets be clear:
This is NOT a Sigil (or any other editor, caused problem).
This is a terrible ('Naked Text') ,coding issue. that can be fixed using a decent editor like Sigil
Code:
</head>
<body>
<h1>chapter 1</h1>
text
<p>text</p>
<p>text</p>
text
</p> <<< I assume this is the second case
I would do 2 passes of fixes (lime, sky blue) in REGEX mode:
first:
Code:
Looks for naked between a /H1 at the end of a line and a P tag at the start of a line
Search: </h1>\s+(.+?)\s+<p>
Replace: <h1><p>\1</p> <p>
second: looks for naked between /P and P tags
Code:
Search: </p>\s+(.+?)\s+<p>
Replace: </p> <p>\1</p> <p>
Each looks for the closing tag BEFORE the naked text. And
should stop when it finds the specified opening tag Note OTHER BLOCK TAGS before the specified opening tag.,
will trip this up. (<Div, H#, Blockquote>)
USE EXTREME CARE if using a 'Replace all'