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

Allow specifying capture group(s) linkifier attaches link(s) to #23976

Open
i-ky opened this issue Jan 4, 2023 · 0 comments
Open

Allow specifying capture group(s) linkifier attaches link(s) to #23976

i-ky opened this issue Jan 4, 2023 · 0 comments
Labels

Comments

@i-ky
Copy link

i-ky commented Jan 4, 2023

I manage a Zulip organization where we discuss OpenStreetMap. OSM data model is based around key=value pairs called "tags". So when talking about OSM different key=value pairs are mentioned quite often. The meaning and intended use of each key (often in combination with specific set of values) is documented in OSM Wiki. It is impossible to remember all the details of tag use, so it is always handy to have a link to respective key and value pages in OSM Wiki.

Unfortunately, the best I can do in Zulip is adding a couple of linkifiers:

Pattern URL format string
(?P<key>[\w:]+)=(?P<tag>\w+) https://wiki.openstreetmap.org/wiki/Tag:%(key)s%3D%(tag)s
(?P<key>[\w:]+)=\* https://wiki.openstreetmap.org/wiki/Key:%(key)s

The result looks like so:

The surface=* key is used to provide additional information about the physical surface of roads/footpaths and some other features, particularly regarding material composition and/or structure.
surface=asphalt tag is used for objects with asphalt surface.

Ideally, it should look like so:

The surface=* key is used to provide additional information about the physical surface of roads/footpaths and some other features, particularly regarding material composition and/or structure.
surface=asphalt tag is used for objects with asphalt surface.

Note how key=value construct links to both key and value pages.

This is how adding linkifier may look like to support this functionality:

Add a new linkifier
Pattern: (?P<key>[\w:]+)=(?P<tag>\w+)
Capture group to linkify: key
URL format string: https://wiki.openstreetmap.org/wiki/Key:%(key)s
Capture group to linkify: tag
URL format string: https://wiki.openstreetmap.org/wiki/Tag:%(key)s%3D%(tag)s
Add link

When linkifier's Pattern matches some text, it should convert portion, matched by Capture group to linkify, to a link leading to a respective URL format string. Add link button should allow user to add more Capture group to linkify + URL format string pairs.

@alya alya added feedback wanted new feature A proposed new feature for the product area: markdown (linkifiers) labels Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants