# API docs - offline usage

**URL:** <https://forum.crystal-lang.org/t/api-docs-offline-usage/4806>\
**Category:** Help & Support\
**Created:** [July 24, 2022, 9:18am UTC](https://forum.crystal-lang.org/t/api-docs-offline-usage/4806 "2022-07-24T09:18:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![4ndyfix](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/4ndyfix/32/1039_2.png) [@4ndyfix](https://forum.crystal-lang.org/u/4ndyfix)\
**Post date:** [July 24, 2022, 9:18am UTC](https://forum.crystal-lang.org/t/api-docs-offline-usage/4806/1 "2022-07-24T09:18:10Z")

</div>

Hi,  
I downloaded crystal-1.5.0-docs.tar.gz from the github release page for offline usage.  
The html links work very well, but the search field doesn’t work at all.

Is it possible to get this working as well?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![straight-shoota](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/straight-shoota/32/36_2.png) [@straight-shoota](https://forum.crystal-lang.org/u/straight-shoota)\
**Post date:** [July 24, 2022, 9:45am UTC](https://forum.crystal-lang.org/t/api-docs-offline-usage/4806/2 "2022-07-24T09:45:08Z")

</div>

Search should work offline as well (when opened as a local file instead of served via HTTP).  
It works for me. Tested in Firefox and Chromium-based browsers.

What browser are you using? Are there any error messages in the console?

---

<div class="post-metadata">

**Author:** ![4ndyfix](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/4ndyfix/32/1039_2.png) [@4ndyfix](https://forum.crystal-lang.org/u/4ndyfix)\
**Post date:** [July 24, 2022, 10:04am UTC](https://forum.crystal-lang.org/t/api-docs-offline-usage/4806/3 "2022-07-24T10:04:34Z")

</div>

Yes, you are right. I forgot to mention that the browser (Firefox 102.0) runs in a docker container. The Firefox web-developer-tools console says “CrystalDocs search index not initialized, delaying search” if I type something info the field …

---

<div class="post-metadata">

**Author:** ![zw963](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/zw963/32/1623_2.png) [@zw963](https://forum.crystal-lang.org/u/zw963)\
**Post date:** [July 25, 2022, 3:01am UTC](https://forum.crystal-lang.org/t/api-docs-offline-usage/4806/4 "2022-07-25T03:01:39Z")

</div>

It works for me, I open API document from my favorite like this: file:///home/zw963/Crystal/docs/index.html in Firefox, it can search keyword successful, when click on source code, it jump to the file in github with current release version.

---

<div class="post-metadata">

**Author:** ![4ndyfix](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/4ndyfix/32/1039_2.png) [@4ndyfix](https://forum.crystal-lang.org/u/4ndyfix)\
**Post date:** [August 8, 2022, 7:48pm UTC](https://forum.crystal-lang.org/t/api-docs-offline-usage/4806/5 "2022-08-08T19:48:01Z")

</div>

Sorry, it was my mistake.  
If you really really want to use the docs offline, you have to replace all https-URLs of all HTML-files with local file-URLs. Therefore I did the following:

`> find crystal-docs/ -name "*.html" -exec sed -i 's@https://github.com/crystal-lang/crystal/blob/.*/src@file:///usr/share/crystal/src@g' {} \;`

This is necessary in order to have valid links to local (offline) sourcecode files.  
The search field now is working as expected.  
First I replaced completely all files. But if you replace also the URLs in search-index.js the search is broken!  
Unfortunately too little Javascript know-how …

---

<div class="post-metadata">

**Author:** ![zw963](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/zw963/32/1623_2.png) [@zw963](https://forum.crystal-lang.org/u/zw963)\
**Post date:** [August 9, 2022, 6:31am UTC](https://forum.crystal-lang.org/t/api-docs-offline-usage/4806/6 "2022-08-09T06:31:33Z")

</div>

If you do like this, you have to handle the jump to the specified line in your’s editor?

e.g. `#L287` of following url.

> <https://github.com/zw963/crystal/blob/994c70b10/src/string_scanner.cr#L287>

will be replace to

file:///usr/share/crystal/src/string\_scanner.cr#L287

How you jump to the line 287 ?

---

<div class="post-metadata">

**Author:** ![4ndyfix](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/4ndyfix/32/1039_2.png) [@4ndyfix](https://forum.crystal-lang.org/u/4ndyfix)\
**Post date:** [August 9, 2022, 2:21pm UTC](https://forum.crystal-lang.org/t/api-docs-offline-usage/4806/7 "2022-08-09T14:21:58Z")

</div>

Indeed, jump to a line doesn’t work.  
I know about this, but found no solution until now … it seems to be a Github feature …

---

<div class="post-metadata">

**Author:** ![zw963](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/zw963/32/1623_2.png) [@zw963](https://forum.crystal-lang.org/u/zw963)\
**Post date:** [August 9, 2022, 4:50pm UTC](https://forum.crystal-lang.org/t/api-docs-offline-usage/4806/8 "2022-08-09T16:50:46Z")

</div>

You can try replace `#L` to `:`,

e.g.

file:///usr/share/crystal/src/string\_scanner.cr#L287

convert to

file:///usr/share/crystal/src/string\_scanner.cr:287

Then change system to use your’s editor open it, most of editor probably support this.
