How to create HTML links inside a LaTeX block

39 views Asked by At

I'm pretty deep into a yak shaving project and thought it was time to involve a broader audience. I am writing documentation and want to have highlighted text (regular serifed text with yellow background, not a code block) in my GitHub for Enterprise markdown files. Many markdown editors support this with a double-equals-sign modifier, e.g. ==Highlighted Text==. However, it is not supported in the GitHub flavor of markdown.

An answer to another post suggests HTML tags, but this is also not supported in GitHub markdown

<mark>Option One</mark>
<span style="background-color: #FFFF00">Option Two</span>

There is an upcoming feature to support various types of color-coded block quotes with a simple syntax, which isn't what I want, but is a nice feature and would be an acceptable compromise for many of my use cases. Alas, this feature is still in beta and is not supported by the version of GitHub for Enterprise I'm using with no delivery timeline.

What sort of works is an embedded block of LaTeX:

${\colorbox{yellow}{\textsf{Highlighted Text}}}$

This looked promising, but I would like to be able to have hyperlinks in some of my highlighted blocks. Unfortunately, GitHub doesn't allow importing packages, which is the only way I know to create hyperlinks in LaTeX.

I'm clueless on how to write regular TeX, but figured some purist had probably created a macro for adding links in their documents. Indeed, I found such a macro on yet another post.

% External hyperlinks
\def\LinkHrefExtText#1#2{%
 \special{html:<a href="#1">}#2\special{html:</a>}}
\def\LinkHrefExt#1{\LinkHrefExtText{#1}{#1}}

However, the \catcode and \special keywords used in the linked macros do not appear to be supported in GitHub either.

I love yak shaving as much as anyone, but learning TeX to solve his problem would be like opening up a fully appointed yak spa that offers hot stone yak massages and private yak pilates classes. Not today, Satan. Not today.

Though, if someone has a creative solution to my problem, I would love to hear about it.

0

There are 0 answers