help_tmpl.coffee 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. app.templates.helpPage = ->
  2. ctrlKey = if $.isMac() then 'cmd' else 'ctrl'
  3. navKey = if $.isMac() then 'cmd' else 'alt'
  4. aliases_one = {}
  5. aliases_two = {}
  6. keys = Object.keys(app.models.Entry.ALIASES)
  7. middle = Math.ceil(keys.length / 2) - 1
  8. for key, i in keys
  9. (if i > middle then aliases_two else aliases_one)[key] = app.models.Entry.ALIASES[key]
  10. """
  11. <nav class="_toc" role="directory">
  12. <h3 class="_toc-title">Table of Contents</h3>
  13. <ul class="_toc-list">
  14. <li><a href="#managing-documentations">Managing Documentations</a>
  15. <li><a href="#search">Search</a>
  16. <li><a href="#shortcuts">Keyboard Shortcuts</a>
  17. <li><a href="#aliases">Search Aliases</a>
  18. </ul>
  19. </nav>
  20. <h1 class="_lined-heading">User Guide</h1>
  21. <h2 class="_block-heading" id="managing-documentations">Managing Documentations</h2>
  22. <p>
  23. Documentations can be enabled and disabled in the <a href="/settings">Preferences</a>.
  24. Alternatively, you can enable a documentation by searching for it in the main search
  25. and clicking the "Enable" link in the results.
  26. For faster and better search, only enable the documentations you plan on actively using.
  27. <p>
  28. Once a documentation is enabled, it becomes part of the search and its content can be downloaded for offline access — and faster page loads when online — in the <a href="/offline">Offline</a> area.
  29. <h2 class="_block-heading" id="search">Search</h2>
  30. <p>
  31. The search is case-insensitive and ignores whitespace. It supports fuzzy matching
  32. (e.g. <code class="_label">bgcp</code> matches <code class="_label">background-clip</code>)
  33. as well as aliases (full list <a href="#aliases">below</a>).
  34. <dl>
  35. <dt id="doc_search">Searching a single documentation
  36. <dd>
  37. The search can be scoped to a single documentation by typing its name (or an abbreviation)
  38. and pressing <code class="_label">tab</code> (<code class="_label">space</code>&nbsp;on mobile).
  39. For example, to search the JavaScript documentation, enter <code class="_label">javascript</code>
  40. or <code class="_label">js</code>, then <code class="_label">tab</code>.<br>
  41. To clear the current scope, empty the search field and hit <code class="_label">backspace</code> or
  42. <code class="_label">esc</code>.
  43. <dt id="url_search">Prefilling the search field
  44. <dd>
  45. The search can be prefilled from the URL by visiting <a href="/#q=keyword" target="_top">devdocs.io/#q=keyword</a>.
  46. Characters after <code class="_label">#q=</code> will be used as search query.<br>
  47. To search a single documentation, add its name (or an abbreviation) and a space before the keyword:
  48. <a href="/#q=js%20date" target="_top">devdocs.io/#q=js date</a>.
  49. <dt id="browser_search">Searching using the address bar
  50. <dd>
  51. DevDocs supports OpenSearch. It can easily be installed as a search engine on most web browsers:
  52. <ul>
  53. <li>On Chrome, the setup is done automatically. Simply press <code class="_label">tab</code> when devdocs.io is autocompleted
  54. in the omnibox (to set a custom keyword, click <em>Manage search engines\u2026</em> in Chrome's settings).
  55. <li>On Firefox, right-click the DevDocs search field and select <em>Add a Keyword for this Search…</em>. Then, type the added keyword followed by a query in the address bar to search DevDocs.
  56. </dl>
  57. <p>
  58. <i>Note: the above search features only work for documentations that are enabled.</i>
  59. <h2 class="_block-heading" id="shortcuts">Keyboard Shortcuts</h2>
  60. <h3 class="_shortcuts-title">Sidebar</h3>
  61. <dl class="_shortcuts-dl">
  62. <dt class="_shortcuts-dt">
  63. <code class="_shortcut-code">&darr;</code>
  64. <code class="_shortcut-code">&uarr;</code>
  65. <dd class="_shortcuts-dd">Move selection
  66. <dt class="_shortcuts-dt">
  67. <code class="_shortcut-code">&rarr;</code>
  68. <code class="_shortcut-code">&larr;</code>
  69. <dd class="_shortcuts-dd">Show/hide sub-list
  70. <dt class="_shortcuts-dt">
  71. <code class="_shortcut-code">enter</code>
  72. <dd class="_shortcuts-dd">Open selection
  73. <dt class="_shortcuts-dt">
  74. <code class="_shortcut-code">#{ctrlKey} + enter</code>
  75. <dd class="_shortcuts-dd">Open selection in a new tab
  76. <dt class="_shortcuts-dt">
  77. <code class="_shortcut-code">alt + r</code>
  78. <dd class="_shortcuts-dd">Reveal current page in sidebar
  79. </dl>
  80. <h3 class="_shortcuts-title">Browsing</h3>
  81. <dl class="_shortcuts-dl">
  82. <dt class="_shortcuts-dt">
  83. <code class="_shortcut-code">#{navKey} + &larr;</code>
  84. <code class="_shortcut-code">#{navKey} + &rarr;</code>
  85. <dd class="_shortcuts-dd">Go back/forward
  86. <dt class="_shortcuts-dt">
  87. <code class="_shortcut-code">alt + &darr;</code>
  88. <code class="_shortcut-code">alt + &uarr;</code>
  89. <br>
  90. <code class="_shortcut-code">shift + &darr;</code>
  91. <code class="_shortcut-code">shift + &uarr;</code>
  92. <dd class="_shortcuts-dd">Scroll step by step<br><br>
  93. <dt class="_shortcuts-dt">
  94. <code class="_shortcut-code">space</code>
  95. <code class="_shortcut-code">shift + space</code>
  96. <dd class="_shortcuts-dd">Scroll screen by screen
  97. <dt class="_shortcuts-dt">
  98. <code class="_shortcut-code">#{ctrlKey} + &uarr;</code>
  99. <code class="_shortcut-code">#{ctrlKey} + &darr;</code>
  100. <dd class="_shortcuts-dd">Scroll to the top/bottom
  101. <dt class="_shortcuts-dt">
  102. <code class="_shortcut-code">alt + f</code>
  103. <dd class="_shortcuts-dd">Focus first link in the content area<br>(press tab to focus the other links)
  104. </dl>
  105. <h3 class="_shortcuts-title">App</h3>
  106. <dl class="_shortcuts-dl">
  107. <dt class="_shortcuts-dt">
  108. <code class="_shortcut-code">ctrl + ,</code>
  109. <dd class="_shortcuts-dd">Open preferences
  110. <dt class="_shortcuts-dt">
  111. <code class="_shortcut-code">esc</code>
  112. <dd class="_shortcuts-dd">Clear search field / reset UI
  113. <dt class="_shortcuts-dt">
  114. <code class="_shortcut-code">?</code>
  115. <dd class="_shortcuts-dd">Show this page
  116. </dl>
  117. <h3 class="_shortcuts-title">Miscellaneous</h3>
  118. <dl class="_shortcuts-dl">
  119. <dt class="_shortcuts-dt">
  120. <code class="_shortcut-code">alt + o</code>
  121. <dd class="_shortcuts-dd">Open original page
  122. <dt class="_shortcuts-dt">
  123. <code class="_shortcut-code">alt + g</code>
  124. <dd class="_shortcuts-dd">Search on Google
  125. <dt class="_shortcuts-dt">
  126. <code class="_shortcut-code">alt + s</code>
  127. <dd class="_shortcuts-dd">Search on Stack Overflow
  128. <dt class="_shortcuts-dt">
  129. <code class="_shortcut-code">alt + d</code>
  130. <dd class="_shortcuts-dd">Search on DuckDuckGo
  131. </dl>
  132. <p class="_note _note-green">
  133. <strong>Tip:</strong> If the cursor is no longer in the search field, press <code class="_label">/</code> or
  134. continue to type and it will refocus the search field and start showing new results.
  135. <h2 class="_block-heading" id="aliases">Search Aliases</h2>
  136. <div class="_aliases">
  137. <table>
  138. <tr>
  139. <th>Word
  140. <th>Alias
  141. #{("<tr><td class=\"_code\">#{key}<td class=\"_code\">#{value}" for key, value of aliases_one).join('')}
  142. </table>
  143. <table>
  144. <tr>
  145. <th>Word
  146. <th>Alias
  147. #{("<tr><td class=\"_code\">#{key}<td class=\"_code\">#{value}" for key, value of aliases_two).join('')}
  148. </table>
  149. </div>
  150. <p>Feel free to suggest new aliases on <a href="https://github.com/freeCodeCamp/devdocs/issues/new">GitHub</a>.
  151. """