WordPress.org

Ready to get started?Download WordPress

Forums

WP Fragmention
id hash anchors highlighted content (8 posts)

  1. Wayne
    Member
    Posted 2 months ago #

    Was it your intention to also highlight content already linked using id attribute and a single hash?

    btw using the name attribute with a single hash does not get highlighted.

    https://wordpress.org/plugins/wp-fragmention/

  2. Christiaan Conover
    Member
    Plugin Author

    Posted 2 months ago #

    I have a feeling the issue you're mentioning pertains to the JavaScript file used by this plugin, but I want to clarify your question.

    Are you saying that if you have an anchor link (single #) the fragmention script is highlighting the anchor text?

  3. Wayne
    Member
    Posted 2 months ago #

    ID attribute
    Yes if you have single hash anchor links on a page, an element with the 'id' attribute does get highlighted, and after further investigation the 'name' attribute exhibits strange behaviour but different to 'id'.

    e.g.
    # id example

    Name attribute
    Although at first I thought the 'name' attribute was working as normal, not all is right with it, click on this example link and then click the 'resolution' anchor link. First time you click 'resolution' the anchor links to itself and highlights the anchor link, then if you click again it takes you to the correct position in the page, but if you scroll up it still highlights the anchor link instead.

    Plus (+) in text
    I'm also noticing that if you have + signs in your text which are included in the fragmention link, the fragmention will not work, here's a fragmention example with + in text. I guess this is to be expected though, since fragmention replaces space between words with a + in the url.

    Single hash (#) behaviour
    I think something is not ignoring single hash anchor links, since this example looks for the 1st mention of 'fro' in the text rather the correct position.

    I'm also using the fragmention chrome extension, if you turn this on and off the text remians highlighed at the top of the page but the anchor link takes you to the correct position.

  4. Wayne
    Member
    Posted 2 months ago #

    I tried turning off plugin and leaving the chrome extension activated and all the issues still seem to be present apart from the highlight is missing, which presumably is added by your plugin css.

    So it does seem to be an issue with the fragmention script rather than the something introduced by the plugin.

    I also noticed something else about the Plus (+) in text issue, it only fails if the + is at the beginning of the text.

  5. Christiaan Conover
    Member
    Plugin Author

    Posted 2 months ago #

    Thanks for the info. I'll pass this information to the fragmention script developer.

    Regarding the + sign in text: you should use URL encoding for any special characters you want to include in a URL. I'm working on adding a hover element that will appear with the fragmention link auto-generated when you highlight text.

  6. Wayne
    Member
    Posted 2 months ago #

    Thanks for passing on.

    Understand what you're saying about special characters, which is useful to know if you are creating fragmentions manually, although probably easier if I avoid text strings which contains special characters altogether.

    I'm currently using the Chrome extension to create fragmentions which is not converting any + signs to %2B, although it seems to be doing others such as % to %25.

    It's the same developer as the script, Jonathan Neal, so I've sent him some feedback via the Chrome extension, plus I've also left a comment on Kevin Mark's blog.

  7. Wayne
    Member
    Posted 2 months ago #

    Like the sound of the the hover element, which presumably will allow any visitor to create a fragmention. I highlight text a lot followed by a right click to initiate some browser/extension action, so I wouldn't want it to get in the way of that though.

  8. Christiaan Conover
    Member
    Plugin Author

    Posted 2 months ago #

    Good point, thanks for the feedback.

Reply

You must log in to post.

About this Plugin

About this Topic