remarkjs / remark-github

remark plugin to link references to commits, issues, pull-requests, and users, like on GitHub

Home Page:https://remark.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature request] Allow transform links only

Airkro opened this issue · comments

Initial checklist

Problem

We want to keep references as text and transform links only.

Solution

When options.repository == false, disable references transform.

Alternatives

No.

Hi! Thanks for taking the time to contribute! This has been marked by a maintainer as needing more info. It’s not clear yet whether this is an issue. Here are a couple tips:

  • Spend time framing the issue! The more time you put into it, the more we will
  • Often, maintainers respond with why for several back and forths; rubber duck debugging might help avoid that
  • Folks posting issues sometimes fall for xy problems: asking for a certain solution instead of raising the root problem

Thanks,
— bb

Keep references as text, don't touch them:

*   Commit: f8083175fe890cbf14f41d0a06e7aa35d4989587
*   Commit (fork): foo@f8083175fe890cbf14f41d0a06e7aa35d4989587
*   Commit (repo): remarkjs/remark@e1aa9f6c02de18b9459b7d269712bcb50183ce89
*   Issue or PR (`#`): #1
*   Issue or PR (`GH-`): GH-1
*   Issue or PR (fork): foo#1
*   Issue or PR (project): remarkjs/remark#1
*   Mention: @wooorm

And transform links:

*   Commit: <https://github.com/remarkjs/remark/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89>
*   Commit comment: <https://github.com/remarkjs/remark/commit/ac63bc3abacf14cf08ca5e2d8f1f8e88a7b9015c#commitcomment-16372693>
*   Issue or PR: <https://github.com/remarkjs/remark/issues/182>
*   Issue or PR comment: <https://github.com/remarkjs/remark-github/issues/3#issue-151160339>
*   Mention: <https://github.com/ben-eb>
commented
  • I’m not sure, this project tries to match how markdown is rendered in issues/PRs/comments on GitHub, that’s not what GitHub does
  • “Link transforming” also uses options.repository, we can’t do it without

Sound's reasonable but... I don't know what to say.

I’m not sure, this project tries to match how markdown is rendered in issues/PRs/comments on GitHub, that’s not what GitHub does

A subset of "what GitHub does" is not that bad?

“Link transforming” also uses options.repository, we can’t do it without

It does but it doesn't have to...

commented

A subset of "what GitHub does" is not that bad?

It might not be.
But it’s generally good to have things focus on one thing. And not try and do everything.
Folks can make their own plugins to do whatever they want.

It does but it doesn't have to...

…but then how would it work? It sounds different from the current code:

visit(tree, 'link', (node) => {
.
So it’s not just a subset. It’s new, more, and different code.
So why not make your own plugin?

I will make a folk version.
Before that, I always talk to maintainers to find out they want it or not (and what I miss).
Now I know the answer is no. I make a remark-github-links someday.

commented

Yeah, that’s good!

Though, I haven’t decided yet. I can’t decide yet. Because what you’re asking doesn’t work (repository: false will break linking, which needs a repository) and I don’t understand how you want it to work.

We know what Github URL like:

Just turn

<https://github.com/remarkjs/remark/issues/182>

into

[remarkjs/remark#182](https://github.com/remarkjs/remark/issues/182)

I think options.repository is not needed.

In many cases, we don't need to compare options.repository with the link.

commented

As I understand it, you want behavior that GitHub does not provide.
Instead of handling these links, as GH does in relation to a certain repo, you want links to be handled regardless of repo.
So the behavior you’re looking for is not just a part of this plugin, but a new part to this this plugin.
I can understand such additions for many plugins, but the goal of this plugin is to match GitHub. So I think it’s best to put the behavior you want in a separate plugin.

Good luck!