HTML Formatter
HTML को फ़ॉर्मैट और beautify करें या minify करें। Indent size, comment stripping, और self-closing tag awareness।
परिणाम देखने के लिए ऊपर इनपुट डालें।
JXXR1 द्वारा बनाया गया · ♥ स्पॉन्सर करें · ☕ मुझे coffee दिलाएं
यह किसके लिए है?
HTML markup आपके editor में सभी प्रकार की states में आता है — production के लिए minified, templating engines द्वारा whitespace की परवाह किए बिना generated, हाथ से typed और असंगत रूप से indented। यह tool किसी भी HTML fragment को प्रत्येक nested element के लिए consistent indentation के साथ reformat करता है, void elements (<img>, <br>, <meta>) और inline elements (<a>, <span>, <strong>) को पहचानता है ताकि output वास्तविक HTML की तरह दिखे, layout-by-rule की तरह नहीं। Minify mode inter-tag whitespace और वैकल्पिक रूप से comments को strip करता है। सब कुछ आपके browser में रहता है।
कब इस्तेमाल करें
- एक minified HTML email या किसी page की "view source" copy को pretty-print करना ताकि आप उसकी संरचना पढ़ सकें।
- Code review में paste करने से पहले CMS / WYSIWYG से snippet साफ़ करना।
- Deploy करने से पहले एक static HTML asset को minify करना — wire पर कम bytes, कोई comments leak नहीं।
- Publish करने से पहले template से author comments strip करना।
आम गलतियाँ
- यह एक pragmatic tokenizer है, पूर्ण HTML5 parser नहीं। यह real-world fragments पर अच्छी तरह काम करता है लेकिन गंभीर रूप से malformed input से recover नहीं होगा जिस तरह browsers करते हैं (browsers पूरा HTML parsing algorithm चलाते हैं और errors को चुपके से fix करते हैं — यह tool नहीं करता)।
<pre>,<textarea>,<script>,<style>के अंदर whitespace संरक्षित है। इन elements को raw के रूप में treat किया जाता है और re-indented नहीं होते।- Inline elements अपने parent text के साथ same line पर रहते हैं —
<p>some <b>bold</b> text</p>को lines में split नहीं किया जाएगा। - "Collapse whitespace" कुछ content के लिए rendered output बदलता है। दो spaces एक हो जाते हैं। यदि आपका design multiple spaces या non-breaking sequences पर निर्भर है, तो इसे off रखें।
- HTML में self-closing notation cosmetic है।
<br/>और<br>HTML5 में equivalent हैं; यह tool जो आपने लिखा वह preserve करता है। - Minify security boundary नहीं है। Secrets छिपाने के लिए comments strip करने पर भरोसा न करें — वे पहले से client को ship किए जा चुके हैं।