Skip to main content
Known Participant
December 6, 2018
Question

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

  • December 6, 2018
  • 5 replies
  • 2322 views

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

This topic has been closed for replies.

5 replies

Nancy OShea
Community Expert
Community Expert
June 30, 2022

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
Participating Frequently
July 1, 2022

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. 

B i r n o u
Community Expert
Community Expert
July 1, 2022

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

Participating Frequently
June 30, 2022
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.)

Known Participant
December 8, 2018

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

Known Participant
December 10, 2018

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.

Legend
December 6, 2018

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.

Known Participant
December 6, 2018

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 />.

Jon Fritz
Community Expert
Community Expert
December 6, 2018

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.

Jon Fritz
Community Expert
Community Expert
December 6, 2018

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.

Known Participant
December 6, 2018

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.

Jon Fritz
Community Expert
Community Expert
December 6, 2018

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)?