Put Anchors As Prefixes

Summary

I'd prefer anchors to be prefixes rather than containers.

Detailed Description

Today, each paragraph element is enclosed in an anchor tag to enable cross references. I'd prefer they were prefixed to the content instead of containing the content. This change would corrrect some links in some browsers that let long heading scroll off the top of the screen when you link to the heading (browser issue, but the prefix approach avoids the issue). It also ensures that CSS information targeted at links does not get applied to headings and other paragraphs.

Current output

<div><a name="label">Content of paragraph is here</a></div>

Desired output

<div><a name="label"></a>Content of paragraph is here</div>

Use Cases

Anchors in HTML output files and CHMs...


:) :)) :( ;) :\ |) X-( B)
BenAllums   Are you interested in a recipe to fix this or a setting in the UI to control the behavior?
2007-11-09 14:23:04
PaulMueller   Either solution is fine with me.  When I'm working on Web solutions, I place anchors as prefixes to workaround several known Browser issues.  I would think other users would run into this same issue, so I was thinking about changing this general behavior in the product for everyone.  Is there a benefit to putting it around the content?

2007-11-09 21:00:10
BenAllums   Short answer:
Because we CAN wrap anchors properly in ePublisher.

Long answer:
There are certain OTHER issues that crop up (JavaHelp, HTML Help) which crop up when using prefix anchors.  In Publisher 2003, macros special cased preformatted text.  If the paragraph was not preformatted, we emitted:

  <a name="id"></a>Paragraph

If it was preformatted, we emitted:

  Paragraph<a name="id"></a>

Additionally, one can run into whitespace formating issues and certain browsers will completely drop the anchor if it is empty.

JavaHelp was particularly nasty:

  <a name="id"> </a>Paragraph

resulted in a space at the start of each line.  Moving it to the end clashed with JavaHelp's goal of centering anchors, instead of putting them at the top of the browser page.

...

But anything is possible.

2007-12-11 20:54:16
:\ MikeHedblom   The problem with putting anchors around the content is the contained text is affected by link styles.  The contained text can give the impression that it is a link.  

For example, if you have this style definition:

a:hover   { color: red; font-weight: bold; text-decoration: none }

An then point to the first word(s) in any paragraph on the page, the contained text become Red-Bold, which is very confusing.
2010-12-14 19:03:40
;) BenAllums   Mike,

The default "webworks.css" file addresses your concern by qualifying "hover" highlights for links only:

/* Default style for links */
/*                         */
a:link:active  { color: #0000CC}
a:link:hover   { color: #CC0033}
a:link         { color: #3366CC}
a:visited      { color: #9999CC}

Note the use of "a:link:hover" instead of "a:hover" by itself.
2010-12-20 11:16:11

Enhancements/Put_Anchors_As_Prefixes (last edited 2008-02-13 06:18:24 by localhost)