HTML Purifier: remove tabs, line breaks and gaps between the blocks?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
4 views
Is anyone using HTML Purifier?


Tell me how to remove all the trash that remains after applying the AutoFormat.AutoParagraph.


For example, such input data:
Paragraph 1 the second line of the first paragraph Paragraph 2 Paragraph 3



He processed this way:
Paragraph 1
the second line of the first paragraphParagraph 2Paragraph 3



Now the situation is as follows:

Paragraph 1 the second line of the first paragraphParagraph 2Paragraph 3



Configuration porifera:
$config = HTMLPurifier_Config::createDefault(); $config->set('HTML.DefinitionID', 'ace'); $config->set('HTML.Doctype', 'HTML 4.01 Transitional'); $config->set('Cache.DefinitionImpl', null); $config->set("HTML.AllowedElements",array("p","ul","ol","li","h4","h5","h6","img","a","b","i","s","u","blockquote","sup","sub","pre","br")); $config->set("HTML.AllowedAttributes",array("img.src","img.alt","img.title","a.href","a.title")); $config->set('AutoFormat.AutoParagraph', true); $config->set('AutoFormat.RemoveEmpty.RemoveNbsp', true); $config->set('AutoFormat.RemoveEmpty', true); $config->set('Core.EscapeInvalidTags', true);
by | 4 views

2 Answers

0 like 0 dislike
On the official forum. Confirmed that built-in tools to solve this problem, there is no need to use the regular season :-(
by
0 like 0 dislike
Generally speaking, the line "the second line of the first paragraph" — this is the second paragraph. Because the newline (aka carriage return
, \, etc.) — this is the end of the paragraph. A double line is used to simulate spacing between paragraphs in plain text documents. Accordingly, in such an html indent is inserted through css, not
and other garbage.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jun 14, 2019 by v3shin
0 like 0 dislike
4 answers
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
27,902 users