Gothic-Modding-Community / gmc

Gothic Modding Community github page
https://gothic-modding-community.github.io/gmc/
24 stars 13 forks source link

Update external source links to open in a new tab #12

Closed kamilkrzyskow closed 2 years ago

kamilkrzyskow commented 2 years ago

Only local documentation links should change the current tab address.

kamilkrzyskow commented 2 years ago

As it turned out there is not such setting in the MkDocs to automatically change such links 😭 https://fastapi.tiangolo.com/ uses html <a> tags with the target="_blank", and they added a custom css class external-link that needs to be present to add the nice arrow. https://github.com/tiangolo/fastapi/blob/5c576e42be8f8832f0e225beaa72153a256892d7/docs/en/docs/index.md?plain=1#L118

As gmc does use https://python-markdown.github.io/extensions/attr_list/ we could modify https://github.com/auronen/gmc/blob/2934042e3c0d53fcfba87730fa0938d7c13cd033/docs/zengin/scripts/classes/c_item.md?plain=1#L4

[Gothic library](http://www.gothic-library.ru){:class="external"}

and add the extra css like FastAPI docs.

However this requires manual control by the content writer.
I'll look into another way, maybe some external javascript, that scans the links and adds the external css dynamically 🤔