PHP Tidy替代仅选项卡缩进输出 [英] PHP Tidy alternative to only tab-indent output

查看:76
本文介绍了PHP Tidy替代仅选项卡缩进输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有PHP Tidy替代仅Tab键缩进HTML输出?我只需要后者用于开发/调试目的,就需要遍历生成的输出代码.虽然,尽管我尝试为该简单任务配置Tidy,但我还是不得不避免其他更改.

Is there any PHP Tidy alternative to only tab-indent HTML output? I need the latter for development/debug purposes only to go through the generated output code. Though, as much as I tried to configure Tidy for this simple task, I couldn't without preventing other changes.

推荐答案

两年后,如果没有使用依赖DOM API的实现(如Tidy等),仍然没有库可以实现HTML输出缩进.

Two years later and there is still no library to achieve HTML output indentation without using implementations that rely on DOM API (ie. Tidy and alike).

我已经开发了使用正则表达式标记HTML输入的库.除了添加缩进所需的间距外,没有任何HTML更改.

I've developed library that tokenises HTML input using regular expression. None of the HTML is changed beyond adding the required spacing for indentation.

https://github.com/gajus/dindent

这篇关于PHP Tidy替代仅选项卡缩进输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆