How to quickly surround text with HTML markup in VS 2008?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 17:36:06

问题


I am working with Visual Studio 2008 editor. Is there a way to take a piece of text for example, highlight it and use shortcuts to quickly add markup?
For example, lets say I have a text, I went to: the store and I want to bold it, I have to type <b>the store</b>. Is there a quicker and easier way to do this?


回答1:


With HTML Editor just press Ctrl+B...

With regular text editor VS does not provide something build-in, but you can add custom macros. Something like the following will do job for you.

Sub MakeSelectionBold()
    DTE.ActiveDocument.Selection.Text = "<b>" + DTE.ActiveDocument.Selection.Text + "</b>"
End Sub

You can then assign it to the short-cut or add button to your toolbar.




回答2:


Select text, Ctrl+X, type in your tags which will be autoclosed by vs, Ctrl+V



来源:https://stackoverflow.com/questions/556865/how-to-quickly-surround-text-with-html-markup-in-vs-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!