Open a link in a new window in reStructuredText

后端 未结 4 1163
谎友^
谎友^ 2020-12-05 22:37

I want to open a link in a new window using reStucturedText. Is this possible?

This opens link in the same window:

You can `check your location here.         


        
4条回答
  •  囚心锁ツ
    2020-12-05 23:22

    If you don't want to modify the theme, you can do what Ivonet did but with a custom.js file in the _static/js folder, then adding it to the conf.py like this:

    html_js_files = [
        'js/custom.js'
    ]
    

    Leave out the html tags in _static/js/custom.js if you do this:

    $(document).ready(function () {
       $('a[href^="http://"], a[href^="https://"]').not('a[class*=internal]').attr('target', '_blank');
    });
    

提交回复
热议问题