Page 1 of 1

Remove br tags around images with webhelp output?

Posted: Fri Jan 09, 2015 12:50 am
by tomjohnson1492
When you include an image in a webhelp file, the output puts two br tags before and after the image, like this: http://www.screencast.com/t/dxR4IbnKTB

As a result, I have a lot of excess white space around the image. Why is the webhelp plugin adding all of these br tags in there? This is poor practice as I have little control to add CSS styling there.

Re: Remove br tags around images with webhelp output?

Posted: Sat Jan 10, 2015 8:53 pm
by tomjohnson1492
I'm wondering if there's a fix for this. It looks pretty bad in my output and I'm not quite sure how to fix it. I tried adding display:none for my br tags, but it messes with other elements, such as related links.

Re: Remove br tags around images with webhelp output?

Posted: Sat Jan 10, 2015 9:02 pm
by tomjohnson1492
I added an adjacent sibling select to hide the br tags:

Code: Select all


p.p + br, br + br {display:none;}

Re: Remove br tags around images with webhelp output?

Posted: Tue Jan 13, 2015 12:32 pm
by sorin_ristache
Please post the XML fragment that adds the image to the DITA topic in order to generate the two <br> elements in the WebHelp page. I tried with Oxygen 16.1 and no <br> element was added in the output, but it may be an additional attribute or element that you have in your DITA XML file that creates this difference between my output and your output.

We plan to add a more general fix in the next Oxygen version for any sequence of two adjacent <br> elements in a WebHelp page, but first reproducing the problem with the <br> elements near an <img> would be helpful for us.

Re: Remove br tags around images with webhelp output?

Posted: Wed Jun 08, 2016 2:31 am
by lopresti
I'm seeing similar <br> tags inserted before and after images

[url]https://harmonicinc.box.comImage[/url]


Here is the DITA source for the topic:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="concept_y44_sqf_f5">
<title>Cross-references and links</title>
<shortdesc>Links help readers find information and travel from one topic to
another.</shortdesc>
<conbody>
<p>For detailed information on the different link types, refer to chapter 7 in <cite>DITA
Best Practices</cite>.</p>
<section id="section_o3q_2xq_dw">
<title>Hierarchical links</title>
<p>Hierarchical links are automatically generated when a DITA map is output to PDF or
WebHelp. These links appear in the order of their corresponding topic references
in the map. A parent topic is at the top of the hierarchy. It becomes a landing
or navigation topic that has links to the child topics underneath it. </p>
<fig id="fig_zxr_frp_yv">
<title>WebHelp TOC with links based on map hierarchy</title>
<image placement="break" href="../../images/hierarchical_links_webhelp_mini.png"
id="image_zls_nqp_yv" width="200"/>
</fig>
<fig id="fig_bmg_3rp_yv">
<title>Landing page with links based on map hierarchy and collection-type
attribute</title>
<image placement="break" href="../../images/hierarchical_links_numbered.png"
id="image_hfb_krp_yv"/>
</fig>
</section>

Re: Remove br tags around images with webhelp output?

Posted: Wed Jun 08, 2016 2:33 am
by lopresti

Re: Remove br tags around images with webhelp output?

Posted: Wed Jun 08, 2016 3:18 pm
by bogdan_cercelaru
Hello,

The <br> tags are inserted due to the placement="break" attribute.
You should remove this attribute and the <br> tags will be removed from the WebHelp output.

Regards,
Bogdan

Re: Remove br tags around images with webhelp output?

Posted: Wed Jun 08, 2016 8:48 pm
by lopresti
Thank you! I didn't realize that @placement wasn't necessary when using the <fig> element.