Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reStructuredText: How to remove space after a hyperlink

A hyperlink in reStructuredTest looks like this:

A hyperlink_ is a reference to a data.

.. _hyperlink: https://en.wikipedia.org/wiki/Hyperlink

This works great for languages like English, as each word is clearly separated by a space. However, in some other languages, this may not be always the case. Take Korean for example.

하이퍼링크는 ... (apparently a non-trivial amount of CJK characters are not allowed in StackOverflow, so I'm removing all CJK except for absolutely necessary parts).

Here, '하이퍼링크' is a noun and the tailing character '는' is a postposition. The problem is that if I try to make the word '하이퍼링크' a hyperlink, I'm given two choices.

  1. 하이퍼링크_ 는 ... This produces an output like

    하이퍼링크 는 ...

    with an undesired space after the word 'hyperlink'.

  2. 하이퍼링크_는 ... This won't be recognized by the rst compiler as a valid hyperlink.

I would like a hyperlink without a space at the end of it. Is this possible with reStructuredText?

like image 224
sbbs Avatar asked Mar 07 '26 14:03

sbbs


1 Answers

I figured spaces can be escaped with a backslash \ just like other syntactical components of reStructuredText (such as an underscore _ or a colon :).

하이퍼링크_\ 는 자료를 가리킬 수 있는 참조 고리이다.

_하이퍼링크: https://en.wikipedia.org/wiki/Hyperlink

This will produce a desired output.

like image 124
sbbs Avatar answered Mar 10 '26 07:03

sbbs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!