mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-13 20:14:12 +02:00
A new mappable action to show kitty docs in the browser
This commit is contained in:
@@ -1069,3 +1069,18 @@ def safer_fork() -> int:
|
||||
import atexit
|
||||
atexit._clear()
|
||||
return pid
|
||||
|
||||
|
||||
def docs_url(which: str = '', local_docs_root: str = '') -> str:
|
||||
from urllib.parse import quote
|
||||
from .constants import local_docs, website_url
|
||||
ld = local_docs_root or local_docs()
|
||||
base, frag = which.partition('#')[::2]
|
||||
if ld:
|
||||
base = base or 'index'
|
||||
url = f'file://{ld}/' + quote(base) + '.html'
|
||||
else:
|
||||
url = website_url(base)
|
||||
if frag:
|
||||
url += '#' + frag
|
||||
return url
|
||||
|
||||
Reference in New Issue
Block a user