我经常从客户端获取文本,并希望使用html标签快速设置文本格式,并以指定的字符数包装每行文本。我刚刚安装了Sublime Text 2,它非常不错,但是我真正想做的一件事却无法弄清楚。
我想使用较长的段落,将每个段落包装在p标记段中,然后包装行,以免它们超出屏幕。所以这是我在做什么:
从客户端复制文本并将其粘贴到编辑器中(此示例为2个段落)。
选择文字。
使用Emmet,输入“ p *”,它将p标记放在每个段落的开头,将/ p放在每个段落的结尾。
选择文字。
单击Alt Q换行。
文本会自动换行,但是由于/ p标记中的左尖括号“ <”被附加到每行的开头,并且/ p标记中缺少了尖括号,导致文本损坏。
<p>Our swimming lessons run on a perpetual monthly enrollment system,
<making year-round lessons affordable and convenient. Our online
<registration system allows you to sign up at your convenience and
<monitor your account details easily./p>
<p>Our highly trained swim instructors teach our unique, proven
<curriculum in stages, encouraging swimmers to master the fundamentals
<of every important swimming skill. We continuously encourage
<progression and advancement as each swimmer becomes more confident in
<the water. Our program blends important water safety skills, buoyancy
<principles and correct stroke technique./p>
救命!我究竟做错了什么?
您可以执行以下操作:
Selection -> Expand Selection to Paragraph
(稍后我将向您展示如何制作快捷方式)。现在选中两个段落,每个段落都作为一个选择区域。p
(not p*
)<p></p>
标签括起来:<p>Our swimming lessons run on a perpetual monthly enrollment system, making
year-round lessons affordable and convenient. Our online registration system
allows you to sign up at your convenience and monitor your account details
easily.</p>
<p>Our highly trained swim instructors teach our unique, proven curriculum in
stages, encouraging swimmers to master the fundamentals of every important
swimming skill. We continuously encourage progression and advancement as each
swimmer becomes more confident in the water. Our program blends important
water safety skills, buoyancy principles and correct stroke technique.</p>
要为创建一个键盘快捷键Expand Selection to Paragraph
,请转到Preferences -> Key Bindings - User
并添加以下内容:
{ "keys": ["ctrl+alt+shift+p"], "command": "expand_selection_to_paragraph" }
如果文件为空,则将以上行用方括号括起来[]
:
[
{ "keys": ["ctrl+alt+shift+p"], "command": "expand_selection_to_paragraph" }
]
保存文件,您现在应该可以在CtrlAltShiftP上面的步骤3中使用了。如果需要,可以随意更改组合键,但是请注意,它可能与其他内置组合或插件组合冲突。
注意:我已经在Sublime Text 3上测试了所有这些功能,但是在ST2中应该可以正常工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句