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

fix(exturl): Return encrypted URL with title. #193

Merged
merged 1 commit into from Feb 8, 2021
Merged

fix(exturl): Return encrypted URL with title. #193

merged 1 commit into from Feb 8, 2021

Conversation

ghost
Copy link

@ghost ghost commented Feb 1, 2021

PR Checklist

  • The commit message follows guidelines for NexT.
  • Tests for the changes was maked (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs in NexT website have been added / updated (for features).

PR Type

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Documentation.
  • Translation.
  • Other... Please describe:

What is the current behavior?

Issue resolved: #4 (comment)

What is the new behavior?

Use regular expressions to extract the title

// Return encrypted URL with title.
const title = match.match(/title="([^"]+)"/);
if (title) return `<span class="exturl" data-url="${Buffer.from(href).toString('base64')}" title="${title[1]}">${html}<i class="fa fa-external-link-alt"></i></span>`;

How to test?

In Markdown

[acme.sh][acmesh]
[acmesh]: https://github.com/acmesh-official/acme.sh "An ACME Shell script: acme.sh"

Output:

<span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2FjbWVzaC1vZmZpY2lhbC9hY21lLnNo" title="An ACME Shell script: acme.sh">acme.sh<i class="fa fa-external-link-alt"></i></span>

@stevenjoezhang stevenjoezhang merged commit 3a1b30a into next-theme:master Feb 8, 2021
@stevenjoezhang stevenjoezhang added this to the 8.3.0 milestone Feb 10, 2021
@stevenjoezhang stevenjoezhang mentioned this pull request Mar 28, 2021
47 tasks
moonfox pushed a commit to moonfox/hexo-theme-next that referenced this pull request Apr 5, 2021
lingyf pushed a commit to lingyf/hexo-theme-next that referenced this pull request Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

【必读】更新说明及常见问题
1 participant