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

Auto-link to GitHub issue in Markdown #65

Open
mnapoli opened this issue Dec 12, 2014 · 7 comments
Open

Auto-link to GitHub issue in Markdown #65

mnapoli opened this issue Dec 12, 2014 · 7 comments

Comments

@mnapoli
Copy link
Member

mnapoli commented Dec 12, 2014

GitHub will automatically create a link to an issue in Markdown with text like this:

Implemented in #123.

Couscous could support the same behavior and turn #123 into [#123](https://github.com/CouscousPHP/Couscous/issues/123).

It would only work if the GitHub project is configured in couscous.yml, e.g.:

github:
    user: symfony
    repo: console

(same options that what's used in the default template)

@Zolli
Copy link

Zolli commented Jan 14, 2016

Is this necessary to only works if github integration is enabled?
What if we allow to define a new configuration value:

(I use Phabricator link structure in this example)

issueLink: http://management.company.com/T#ISSUE_ID#

In your example the link for ths issue will be the following: http://management.company.com/T123
Of curse this may be a better solution because not break compatibility in the feature, and, if the user migrates from one issue tracking system to an other the links is easily replaceable.

@cyberbit
Copy link
Contributor

+1 @Zolli's idea. I'm currently trying to implement Couscous into a new release documentation system, but we don't use GitHub at my organization. Having customizable issue links when deploying to something other than GitHub would be fantastic. If I find time, I might be able to submit the pull request to do both GitHub and custom integration, as it's important to me.

@mnapoli
Copy link
Member Author

mnapoli commented Jan 14, 2016

Sounds fair, and doable I guess. There has been a new release hours ago of the commonmark parser, and with the new AST and extension system it seems way easier than before to implement that. For example there is a "twitter auto-linker" plugin: https://github.com/thephpleague/commonmark-extras/blob/master/src/TwitterHandleAutolink/TwitterHandleParser.php

We still need Markdown Extra support however before being able to switch to this Markdown parser :/ (see #134).

@Zolli
Copy link

Zolli commented Jan 15, 2016

Currently, i try to create a Step that replaces issue numbers but i run into a problem with this :)

  • is already occupied by header definition in markdown

There is 2 possible soluton:

  1. Use a custom prefix
    ISSUE-#NUMBER_HERE be nice.
  2. Provide user a way to customize issue matching regex.
    So, we provide a default scheme (like in previous example), and if the user provides a custom one the matcher use this.

This raises some inconsistency across projects, so I do not recommend this.

@mnapoli
Copy link
Member Author

mnapoli commented Jan 15, 2016

@Zolli I haven't looked into the details of the parser but isn't that possible to register # only when it's not the first character of the line?

@Zolli
Copy link

Zolli commented Jan 15, 2016

@mnapoli i think of that, but what if the user want to place the issue number to the beginning of the line? That is a big limitation.

Example:

...
### Limitations

#1212 is the main limitation...
#2121 also...

@mnapoli
Copy link
Member Author

mnapoli commented Jan 15, 2016

Actually I just realized that #123 is not interpreted as a title so it's perfectly valid to turn it into an issue link. Try it out at http://spec.commonmark.org/dingus/

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

No branches or pull requests

3 participants