Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Update) Improve Linkify, escape special chars for BBcode #1769

Merged
merged 1 commit into from
May 21, 2021

Conversation

Oha-you
Copy link
Contributor

@Oha-you Oha-you commented May 20, 2021

  1. Fixes issues with < and > characters in BBcode. Currently this text:

    [size=13][b]Kanojo no Ura Sekai[/b] [i]<TOSHIRO SIDE>[/i][/size]
    

    Produces the following HTML:

    <span style="font-size: 13px;"><span style="font-weight: bold;">Kanojo no Ura Sekai</span>&nbsp;
    <em><toshiro side=""></toshiro></em></span>

    Notice the wrong <toshiro> tags.
    Also <span> inside <span> caused text to be big (wrong style removed).

  2. Improves Linkify function.
    Current regex is outdated and doesn't work for domains with 4+ chars (like unit3d.site) because of [a-zA-Z]{2,3}.
    In general, finding and highlighting links is not a simple task, so it's better to use a dedicated package.
    I compared all modern ones and vstelmakh/url-highlight seemed to be the best. See examples.
    It works fine with existing urls, that's why it was necessary to put ->linky last after ->parse. Different order caused incorrect html.

@HDVinnie HDVinnie merged commit d6aed69 into HDInnovations:master May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants