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

Dreamweaver 2014 for Mac: Insert <br /> in HTML5 in code and design view

Contributor ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

Hi.

I switched from XHTML to HTML5.

In the design view the tag <br> is inserted, in the code view <br />.

I like to get a <br /> in the design view too.

I use macOS Mojave.

I found https://alistapart.com/article/dreamweaver  with the hint, to edit a configuration file.

/Applications/Adobe Dreamweaver CC 2014/Configuration/Objects/Characters/Line Break.htm

But editing that file as described in the article had no effect.

How can solve the problem please?

Further:


I like to modify the new empty file, which appears, when you press CMD+N.

Which config file do I have to edit please?

I like to get a file "unnamed-1.php" with some code in the head, I prefer.

Further:

Which config file do I have to edit, when I want to change the behaviour of CMD+SHIFT+SPACE?

Standard is:  & n b s p ; (spaces only for this forum posting)
I wish to get the unicode character " "

Thanks for your help

Views

1.5K

Translate

Translate

Report

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 ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

For your first issue, the <br> vs <br/> problem? I guess I never noticed it, I use so few <br> tags in general. I don't have any idea if/where that can be changed. Hopefully someone else has an idea.

To change the code of your default new, you can add to the file at...

C: > Program Files > Adobe > Dreamweaver (your version) > configuration > DocumentTypes > NewDocuments > Default.html

I believe the Mac version starts at Macintosh HD > Application support, but someone with a Mac would need to confirm that for you.

To modify the file:

1. Open it in DW and make your changes. Don't worry about the doctype declaration or the charset meta tag, those get changed automatically by DW depending on your settings. Anything else you add will appear in a new document.

2. Save to your desktop


3. Drag from your desktop to the folder path above. You will need Admin rights to drop it in place, overwriting the original

Your final question, for the keyboard shortcut of a non-breaking space, go to...

Edit > Keyboard Shortcuts > Menu Commands > HTML > Non-Breaking-Space.

Votes

Translate

Translate

Report

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
Contributor ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

Thanks for the hint to change default.html

I tried that, without success.

Mac SSD > Applications > Adobe > Dreamweaver 2014 > configuration > DocumentTypes > NewDocuments > Default.html

I just changed

<head>

to

<link href="/css/default.css" rel="stylesheet" type="text/css" />
<head>

I closed DW and reopened it.
CMD+N
The link element does not appear.

I go back to my file manager to check, if the change is really there. in default.html. It is.

Votes

Translate

Translate

Report

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 ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

That's the right spot, I've done that modification myself for every version of DW from CS4 to CC2019.

I know this is a little "is it plugged in" as far as troubleshooting goes, but...

Are you sure you made the change to the Default.html file and not one of the others?
Are you sure you're using the same version of the program as the file you modified (multiple DW versions would all need to be changed)?

Votes

Translate

Translate

Report

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
Contributor ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

Yes, I'm sure. It is /Applications/Adobe Dreamweaver CC 2014/Configuration/DocumentTypes/NewDocuments/Default.html

Votes

Translate

Translate

Report

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
LEGEND ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

mistershortcut  wrote

Hi.

I switched from XHTML to HTML5.

In the design view the tag <br> is inserted, in the code view <br />.

I like to get a <br /> in the design view too.

Its more like you need to get <br> in the code view as html 5 doesnt require the closing tag.

Votes

Translate

Translate

Report

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
Contributor ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

I know that is not required, but I have my reasons. Example: sometimes the markup will be used by a DOM parser of a script. It's safer when every empty element uses the same syntax <element />.

Votes

Translate

Translate

Report

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 ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

Ah, oops, to change non breaking space to something else, I'm not sure where you would look for that. Sorry, I misread that question. Personally, I'd just use the snippet panel and set a keyboard shortcut for it.

Votes

Translate

Translate

Report

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
LEGEND ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

mistershortcut  wrote

I know that is not required, but I have my reasons. Example: sometimes the markup will be used by a DOM parser of a script. It's safer when every empty element uses the same syntax <element />.

Well in that case I would stick to a doctype that uses the <br /> or do a find and replace <br /> with <br> if you are working on an old document and want to use html 5. I dont see the point in using html5 if you are going to use old syntax with it personally.

Votes

Translate

Translate

Report

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 ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

Oh, another item to check, are you creating a new .html document with DW when you hit CMD+N, or is it set to another file type?

You'll need to modify other files if your default action creates something other tan HTML. For example, if your New Page screen is defaulting to .php pages, you'll need to modify the Default.php file.

Votes

Translate

Translate

Report

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
Contributor ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

Yes, I set the "new document" to a HTML5 file:

Dropbox - Screenshot 2018-12-06 23.04.56.png

Votes

Translate

Translate

Report

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
Contributor ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

No, I like to use HTML5, with all it's elements and not XHTML anymore.

<br /> is valid HTML5. So I like to realize it with DW.

Votes

Translate

Translate

Report

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 ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

<br /> =  XHTML syntax. 

Don't expect DW's auto code completion to assist you with that syntax in HTML5 doc types because it's not the W3C standard.  However If you code manually,  you can do whatever you want.

EDIT:  To see the line break, switch to Live View.

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

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
Contributor ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

<br /> is a valid syntax for a void element in HTML5:
HTML syntax - HTML5

Because you wrote "if you code manually":

I meant the auto completion in the code view.

If anyone has an idea, how to solve the 3 unsolved tasks (normalizing autocompletion of br, editing template for CMD+N, non-breaking space with CMD+SHIFT+SPACE as unicode character), I would appreciate hints.

Thanks

Votes

Translate

Translate

Report

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 ,
Dec 07, 2018 Dec 07, 2018

Copy link to clipboard

Copied

as Nancy already told you , in HTML5 the void TAG don't need any closing slash... either the link that you forward explicit said that the slash is optional...

so... if anyway you need and want the closing slah in the BR tag, you just have to edit the file C:\Program Files\Adobe\Adobe Dreamweaver CC Next\configuration\Objects\Characters\Line Break.htm

by replacing <br> by <br />

concerning the default document association as someone already said you, you will have to edit the corresponding file located in the folder C:\Program Files\Adobe\Adobe Dreamweaver CC Next\configuration\DocumentTypes\NewDocuments, you can also create you own new one by adding it to the file C:\Program Files\Adobe\Adobe Dreamweaver CC Next\configuration\DocumentTypes\MMDocumentTypes.xml and adding your model to the previous folder too. if that is not what you're asking for, could you please describe it differently to help me understand what you're exactly looking for

last, when hitting CTRL SHIFT SPACE it enter as expected a  &nbsp; what are you expecting different ?...12.07.2018-09.38.19

Votes

Translate

Translate

Report

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
Contributor ,
Dec 07, 2018 Dec 07, 2018

Copy link to clipboard

Copied

Thanks for your detailed answer.

br
You missunderstand my point in that case. I know that a slash is optional in br. I only want it, because it's safer in a special context.
I edited the mentioned file /Applications/Adobe/Adobe Dreamweaver CC 2014/configuration/Objects/Characters/Line Break.htm
Please see the code below. But is has no effect to the design view. When I press SHIFT+ENTER, a <br> is inserted.

May be it is not the correct file on my localized (German) version.
When I edit it to <br> it has no effect neither to the code view.

new document

I solved the problem
The path must be the following:
/Applications/Adobe Dreamweaver CC 2014/de_DE/Configuration/DocumentTypes/NewDocuments/Default.html
and not
/Applications/Adobe Dreamweaver CC 2014/Configuration/DocumentTypes/NewDocuments/Default.html
Now it works fine.

non breaking spaceI expect, as I wrote, the unicode character and not the entity. I can't describe it better, sorry.
May be it helps to mention, that DW display a little gray circle as a placeholder for the unicode character of the non breaking space in the code view.

Code of "Line Break.htm"

<!-- MENU-LOCATION=NONE -->

<html xmlns:MMString="http://www.macromedia.com/schemes/data/string/">

<head>

<!-- Copyright 2000, 2001, 2002, 2003 Macromedia, Inc. All rights reserved. -->

<title><MMString:LoadString id="insertbar/linebreak" /></title>

</head>

<script language="javascript">

function isDOMRequired() {

    // Return false, indicating that this object is available in code view.

    return false;

}

function objectTag() {

  // Return the html tag that should be inserted

  return "<br />";

}

</script>

<body>

</body>

</html>

Votes

Translate

Translate

Report

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
Contributor ,
Dec 07, 2018 Dec 07, 2018

Copy link to clipboard

Copied

I'm one step further with "br".

To manipulate the inserted tag for SHIFT+ENTER in the code view it is neccessary to create the following new file, when you use a localized version like me.

/Applications/Adobe Dreamweaver CC 2014/de_DE/Configuration/Objects/Characters/Line Break.htm

But:
That file does not manipulate the inserted Tag in the design view, only in the code view.

Is there any way to manipulate the inserted tag in the design view?


Again back to the second open task, the non breaking space:
Do you see any way to get the unicode character with CMD+SHIFT+SPACE, of course as well in the design view and in the code view.
Entities are so ugly and should only be used, when that can't be avoided.

What did I try?

I edited
/Applications/Adobe Dreamweaver CC 2014/de_DE/Configuration/Objects/Characters/NBSP.htm
and
/Applications/Adobe Dreamweaver CC 2014/Configuration/Objects/Characters/NBSP.htm

var nbspChar = "&nbsp";

to

var nbspChar = " ";

I has no effect to CMD+SHIFT+SPACE

I would like to solve a fourth task, which is related to the NBSP:

Typing a " on the keyboard should insert a " in the code view instead of &quot;

Votes

Translate

Translate

Report

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
Contributor ,
Dec 08, 2018 Dec 08, 2018

Copy link to clipboard

Copied

Someone in the thread wanted to know, what I expect with "the unicode character", when I type SHIFT+ENTER in the code view.
Please look at: Dropbox - Screenshot 2018-12-08 09.52.18.png

Votes

Translate

Translate

Report

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
Contributor ,
Dec 10, 2018 Dec 10, 2018

Copy link to clipboard

Copied

Does really no one has an idea how to solve the task with changing the behaviour of CMD+SHIFT+SPACE in the described manner?

I would like so much to get access to that behaviour.

May be I should better open a new thread, because the subject is about something else.

Thanks.

Votes

Translate

Translate

Report

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
Explorer ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

quote

In the design view the tag <br> is inserted, in the code view <br />.

I like to get a <br /> in the design view too.

 

I was facing the same issue, to solve it: 

1. 

go to `C:\Program Files\Adobe\Adobe Dreamweaver 2021\configuration\Objects\Characters\Line Break.htm`

2.

change the code to 

function objectTag() {
  // Return the html tag that should be inserted
  return "<br /> ";
}

note that, the extra space " " at the end is important!

----

note (base on what I tried): 

  • if you use `<br>` or `<br/>`, it will be fine in both design view or code view. 
  • if you use `<br />`, it only works in code view; in design view it will insert `<br>` instead.
  • if you use `<br /> ` (with extra trailing space), it then works in both design view or code view. 

(dont ask me why...

Seems like the js code auto convert the `<br />` somehow.

I was trying with special "character codes" of space, to cheat the js code, no luck.

Turns out adding the "extra trailing space" prevents that auto convert.)

Votes

Translate

Translate

Report

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 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

You mean to display Preformatted CODE in Design view?

In that case, use HTML entities.

 

PREFORMATTED:

 

 

<p><pre><code>&lt;p&gt;This is a paragraph with a line break &lt;br&gt;<br> 
followed by a second line.&lt;/p&gt;</p></code></pre>

 

 

 

RESULT:

<p>This is a paragraph with a line break <br>
followed by a second line.</p>

 

Does that help you?

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

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
Explorer ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

No, I was posting a solution. That was not really a question. 

Its not about using `&lt;br&gt;` to display `<br>`. (Thats html thing, not Dreamweaver thing.) 

--

Its about,

1. you are in the design view 

2. you press `Shift + Enter`

3. a linebreak will be inserted

4. the problem is, the linebreak inserted will be `<br>` instead of `<br />` (you can see this in the html code in Code View)

(this is causing problem in `.xhtml` file)

(>> and this is one of OP's question)

=>

So I post a solution above. 

Votes

Translate

Translate

Report

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 ,
Jul 01, 2022 Jul 01, 2022

Copy link to clipboard

Copied

LATEST

Hi guys.... this thread is four years old... and I already answered the question back then by editing the Line Break.htm file... are we in a new writing of Meredith Stiehm

Votes

Translate

Translate

Report

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