Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Inserting HTML comments from the Insert menu

New Here ,
Jun 27, 2013 Jun 27, 2013

So I understand that the insert menu has been changed in CS6 and then again in CC  (Dreamweaver 12.2). 

http://helpx.adobe.com/dreamweaver/using/changes-insert-options-creative-cloud.html

I am using DW CC.   I want to insert HTML comments quickly in a bunch of different locations in my page code.  Is there a way to do that?

If this must now be done by hand I would like to know why.  The reason for the changes is explained as removing support for deprecated elements, but HTML comments are not deprecated in HTML 5.

http://www.w3.org/html/wg/drafts/html/master/syntax.html#comments

16.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Jun 27, 2013 Jun 27, 2013

There is another option. Select the block of the code and choose the comment option as per your requirement. See image below.

toolbar.jpg

Translate
Adobe Employee ,
Jun 27, 2013 Jun 27, 2013

There is another option. Select the block of the code and choose the comment option as per your requirement. See image below.

toolbar.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 27, 2013 Jun 27, 2013

That is helpful - thank you!

Why would it be a toolbar option but not a menu option? Just to  leave things uncluttered?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jun 27, 2013 Jun 27, 2013

This has been there from many versions.

I consider having it in menu was not so useful for me when I can have it just next to where I am coding.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2013 Jun 27, 2013

I think Adobe is attempting to make the insert menus less cluttered.

Don't forget to use the Snippets folder for storing and inserting re-usable code bits. Also, the insert panel has a Favorites Tab so you can customize it with your most used items.

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 30, 2015 Mar 30, 2015

except that "HTML Comments" isn't one of the options for the Favorites menu.

C'mon, it's not like "comments, who uses them any more?" Putting that back on the menu under what I recall as an HTML section wouldn't make the menu any more cluttered than it already is.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 18, 2015 Nov 18, 2015

I remember back in the good old homesite days you could press shift-ctrl-m and get a comment around the block of code you have selected that would be appropriate to the code (html, css, javascript). I have no idea why this was ever removed.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 18, 2015 Nov 18, 2015

Adding comments to your DW custom Snippets folder is easy.

Reuse code with Code Snippets | Adobe Dreamweaver CC tutorials

And you can associate your Snippets with custom keyboard shortcuts.

Dreamweaver Help | Keyboard shortcuts

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 19, 2016 Jun 19, 2016

Thanks Nancy but I was talking specifically about one command that would wrap the selected text with comment delimiters appropriate to the language of the code you're currently editing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 19, 2016 Jun 19, 2016

In DW CC Code View or the Code Inspector panel, there's a tool bar icon for inserting comments. See screenshots.

code-comment.jpg

code-comment.jpg

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 20, 2016 Jun 20, 2016

Thanks again Nancy but I was talking specifically about one command that would wrap the highlighted content in comments. Navigating through a menu to make a selection would take longer than just adding the appropriate delimiters.

In Homesite there was a command "Shift-Ctrl-M" that would insert the correct comments (in html it would add <!-- --> and in css and javascript it would add /* */).

It's a small thing but I used it all the time. Nowadays I map the html comment to that keystroke since that's the one I use the most but it would still be nice if dreamweaver just had a context-aware comment command.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2016 Jun 20, 2016

Feel free to use the official Feature Request Form.  If enough people suggest the same idea, it might be added to a future release.

Feature Request/Bug Report Form

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2016 Jun 20, 2016

You can use the Snippets panel to do exactly that, add an html comment around a selection using a keyboard shortcut, here's how...

1. Click the + on the bottom of the Snippet Window

2. For Name, put in HTML Comment

3. Make sure the "Wrap Selection" radio button is chosen
4. For "Insert before" enter: <!--
5. For "Insert after" enter: -->
6. Hit OK
7. Go to Edit > Keyboard Shortcuts
8. In the Commands dropdown, go to Snippets
9. Browse to your newly created custom Snippet and click to highlight it
10. Click in the Press key field and hit your key combo, for example: Ctrl + Shift + \ (not set in the default shortcuts)
11. Hit OK.

From there on out, when you make a selection and hit that shortcut, the selection will be wrapped in html comment tags from Code or Design Views.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 20, 2016 Jun 20, 2016

Thanks but my issue is that if I'm editing a javascript or css file then I need different comments delimiters inserted. I could map /* */ to a different command but it just seems more natural to have one command that will insert the correct comments based on the language of the code that's being edited.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2016 Jun 20, 2016
LATEST

Aside from the Feature Request form Nancy pointed out, another route to get to the dev team would be to start an Idea over here: Dreamweaver Ideas and getting enough votes that Adobe adds the function to the program (which has happened in the recent past).

Until then, you're pretty much stuck using Snippets with Shortcuts, the Add Comment menu in the Code View sidebar or manually adding them.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2016 Apr 22, 2016

Using keyboard shortcuts,

in command "menu", select "Modify Code", and then choose "Apply HTML comment".

(i don't know if the names are translated correctly, because i'm using the italian version of the program)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines