remarkjs / remark-github

remark plugin to link references to commits, issues, pull-requests, and users, like on GitHub
https://remark.js.org
MIT License
179 stars 22 forks source link

[Feature request] Allow transform links only #36

Closed Airkro closed 2 years ago

Airkro commented 2 years ago

Initial checklist

Problem

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

Solution

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

Alternatives

No.

github-actions[bot] commented 2 years ago

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:

Thanks, — bb

Airkro commented 2 years ago

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>
wooorm commented 2 years ago
Airkro commented 2 years ago

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...

wooorm commented 2 years ago

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: https://github.com/remarkjs/remark-github/blob/f3eb4077db0ab7dbd0cf4473d44fc348f5a3c3af/lib/index.js#L167. So it’s not just a subset. It’s new, more, and different code. So why not make your own plugin?

Airkro commented 2 years ago

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.

wooorm commented 2 years ago

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.

Airkro commented 2 years ago

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.

wooorm commented 2 years ago

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!