# Automatically linking "library(this and that)" in Discourse to the docs

**URL:** <https://swi-prolog.discourse.group/t/automatically-linking-library-this-and-that-in-discourse-to-the-docs/3926>\
**Category:** Tools\
**Tags:** how-to\
**Created:** [May 7, 2021, 5:55am UTC](https://swi-prolog.discourse.group/t/automatically-linking-library-this-and-that-in-discourse-to-the-docs/3926 "2021-05-07T05:55:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [May 7, 2021, 5:55am UTC](https://swi-prolog.discourse.group/t/automatically-linking-library-this-and-that-in-discourse-to-the-docs/3926/1 "2021-05-07T05:55:44Z")

</div>

This already works for predicates, so if I wrote atom//1 it gets a link to the correct spot. Is it possible to automate this for library mentions, so that if I typed in “library(dcg/basics)” this would get a link to [https://www.swi-prolog.org/pldoc/man?section=basics](https://www.swi-prolog.org/pldoc/man?section=basics)?

If someone pointed me to the right direction I can try to do it. Or is it so that there is no clear 1-to-1 correspondence between the library name (as used inside use\_module/1) and the documentation page?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [May 7, 2021, 7:08am UTC](https://swi-prolog.discourse.group/t/automatically-linking-library-this-and-that-in-discourse-to-the-docs/3926/2 "2021-05-07T07:08:34Z")

</div>

That shouldn’t be too hard if we can make [www.swi-prolog.org](http://www.swi-prolog.org) reply with the URL given such a pattern. As is though, I’m afraid there is no uniformity and thus this either requires cleaning up the documentation to make sure the library references are uniform or adding a table ☹

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [May 7, 2021, 7:55am UTC](https://swi-prolog.discourse.group/t/automatically-linking-library-this-and-that-in-discourse-to-the-docs/3926/3 "2021-05-07T07:55:53Z")

</div>

> [@jan](#):
>
> As is though, I’m afraid there is no uniformity and thus this either requires cleaning up the documentation to make sure the library references are uniform or adding a table

Yes, looking at the library names and the links I was afraid this was the case. If it isn’t something that you can easily explain how to proceed with, don’t bother. It is very easy to add the link manually and no one has missed this feature until now.

---

<div class="post-metadata">

**Author:** ![jamesnvc](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jamesnvc/32/14_2.png) [@jamesnvc](https://swi-prolog.discourse.group/u/jamesnvc)\
**Post date:** [May 7, 2021, 1:22pm UTC](https://swi-prolog.discourse.group/t/automatically-linking-library-this-and-that-in-discourse-to-the-docs/3926/4 "2021-05-07T13:22:04Z")

</div>

For reference though, [here](https://github.com/jamesnvc/discourse-linkify-prolog-predicates) is the source for the plugin that does the auto-linkifying for the predicate names. As Jan says though, it requires cooperation from the SWI-Prolog site to send the URLs for a given predicate name.
