Skip to content

Autolink Extension not detecting links that start with www #298

Closed

Description

@rockycodes

autolink-java supports detecting WWW links, but the Autolink Extension for commonmark-java does not. This is easily fixed by removing this line so that the default detecting logic for autolink-java will be used. I am happy to submit a pr to do this, but wanted to first check if there is a historical reason for doing it this way since the more limited list seems to have been intentionally added in this change.

Fwiw, this is a blocker for me using the Autolink Extension in my project. If the more limited list of supported link types is intentional, it should be called out in the documentation.

Steps to reproduce the problem (provide example Markdown if applicable):

www.google.com

Expected behavior:

<a href="http://www.google.com" class="text-blue-600" target="_blank">www.google.com</a>

Actual behavior:

<p>www.google.com</p>

Activity

  1. changed the title [-]Autolink Extenstion not detecting links that start with `www`[/-] [+]Autolink Extension not detecting links that start with `www`[/+] on Sep 21, 2023
  2. robinst commented on Feb 9, 2024

    @robinst
    Collaborator

    In bff088e the WWW mode didn't exist yet, that was only added in November 2016: robinst/autolink-java#8 (comment).

    So the reason is simply that it hasn't been added as an option to AutolinkExtension. I'd be happy for it to be added, yeah. You can copy how StrikethroughExtension does options (add a builder). And we would probably want our own enum instead of exporting autolink's.

  3. rdestefa commented on Oct 4, 2025

    @rdestefa
    Contributor

    I took a stab at a PR for this feature. Would be nice to support www links. #406

  4. robinst commented on Oct 12, 2025

    @robinst
    Collaborator

    Hi @rockycodes! Thanks to @rdestefa, this has been released in version 0.27.0: https://github.com/commonmark/commonmark-java/blob/commonmark-parent-0.27.0/CHANGELOG.md#0270---2025-10-12

    You don't need to change anything, detection of www links is enabled by default.

  5. rockycodes commented on Oct 13, 2025

    @rockycodes
    Author

    Wahoo! Thanks @rdestefa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions