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

Detect URLs for Links #356

Closed
nathanclevenger opened this issue Apr 21, 2023 · 5 comments Β· Fixed by #358
Closed

Detect URLs for Links #356

nathanclevenger opened this issue Apr 21, 2023 · 5 comments Β· Fixed by #358
Labels

Comments

@nathanclevenger
Copy link
Sponsor

In many of our use cases, the code would have many embedded URLs and we really need the URLs to be clickable like you can with any JSON viewer plugin in your browser:

{
  "πŸ•΅οΈ Inspect Vehicle": "https://inspect.vin/1C4HJXEN5MW592818",
  "πŸš› Transport Vehicle": "https://transport.vin/1C4HJXEN5MW592818",
  "☁️ Connect Your Vehicle": "https://auth.vin/1C4HJXEN5MW592818",
  "🏦 Get Pre-Approved": "https://pre.approved.vin/1C4HJXEN5MW592818",
  "πŸ•ΆοΈ Insure Vehicle": "https://ins.vin/1C4HJXEN5MW592818",
  "πŸ’Έ Finance & Insurance": "https://fi.vin/1C4HJXEN5MW592818",
  "πŸ’Έ Buy Vehicle": "https://buy.vin/1C4HJXEN5MW592818",
  "πŸ’Έ Get Vehicle Service Contract": "https://vsc.vin/1C4HJXEN5MW592818"
}

Is this something that can be supported? Is there any workaround in the meantime? We can currently do this with Prism's Autolinker (https://prismjs.com/plugins/autolinker/), but we much prefer to use CodeHike if at all possible

@pomber
Copy link
Contributor

pomber commented Apr 21, 2023

The workaround is to use the link annotation: https://codehike.org/docs/annotations#link-annotation.

But we could add an autolink option.

@nathanclevenger
Copy link
Sponsor Author

@pomber we just upped our sponsorship and added a 1 time payment for additional support.

An autolink option would be amazing, and if you are able to add that soon we can use CodeHike as the basis for the documentation for our several hundred APIs that are all hypermedia link driven ... adding support for this feature would be greatly appreciated.

@pomber
Copy link
Contributor

pomber commented Apr 23, 2023

I added a global autoLink option (false by default):

mdxOptions = {
  remarkPlugins: [
    [
      remarkCodeHike,
      {
        theme: someTheme,
        autoLink: true,
      },
    ],
  ],
}

Demo

@nathanclevenger
Copy link
Sponsor Author

Amazing @pomber! Thank you so much!! πŸ™

@github-actions
Copy link

github-actions bot commented May 3, 2023

πŸš€ Issue was released in v0.8.3 πŸš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants