1
0
mirror of https://github.com/RyanGreenup/cadmus.git synced 2025-06-01 05:54:56 +02:00
cadmus/site/search.html
2020-07-24 21:07:21 +10:00

766 lines
23 KiB
HTML

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="shortcut icon" href="assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-5.3.2">
<title>Search</title>
<link rel="stylesheet" href="assets/stylesheets/main.fe0cca5b.min.css">
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
<style>body,input{font-family:"Roboto",-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono",SFMono-Regular,Consolas,Menlo,monospace}</style>
<link rel="stylesheet" href="css/SpaceMacsNotableFirst.css">
</head>
<body dir="ltr">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#what-does-it-do" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid" aria-label="Header">
<a href="." title="Cadmus" class="md-header-nav__button md-logo" aria-label="Cadmus">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
<label class="md-header-nav__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
</label>
<div class="md-header-nav__title" data-md-component="header-title">
<div class="md-header-nav__ellipsis">
<span class="md-header-nav__topic md-ellipsis">
Cadmus
</span>
<span class="md-header-nav__topic md-ellipsis">
Search
</span>
</div>
</div>
<label class="md-header-nav__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active">
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</label>
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" data-md-component="search-reset" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="." title="Cadmus" class="md-nav__button md-logo" aria-label="Cadmus">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
Cadmus
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="index.html" title="What does it do" class="md-nav__link">
What does it do
</a>
</li>
<li class="md-nav__item">
<a href="Convert.html" title="Search" class="md-nav__link">
Search
</a>
</li>
<li class="md-nav__item">
<a href="Export.html" title="Search" class="md-nav__link">
Search
</a>
</li>
<li class="md-nav__item">
<a href="find.html" title="Find" class="md-nav__link">
Find
</a>
</li>
<li class="md-nav__item">
<a href="preview.html" title="Search" class="md-nav__link">
Search
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
Search
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg>
</span>
</label>
<a href="search.html" title="Search" class="md-nav__link md-nav__link--active">
Search
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Table of contents
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#what-does-it-do" class="md-nav__link">
What does it do
</a>
</li>
<li class="md-nav__item">
<a href="#how-do-i-use-it" class="md-nav__link">
How Do I use it
</a>
<nav class="md-nav" aria-label="How Do I use it">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#keyboard-shortcuts" class="md-nav__link">
Keyboard Shortcuts
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#when-would-this-be-used" class="md-nav__link">
When Would This Be Used
</a>
<nav class="md-nav" aria-label="When Would This Be Used">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#example" class="md-nav__link">
Example
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#how-does-it-work" class="md-nav__link">
How does it Work
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="nav-7" type="checkbox" id="nav-7">
<label class="md-nav__link" for="nav-7">
Misc
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
</span>
</label>
<nav class="md-nav" aria-label="Misc" data-md-level="1">
<label class="md-nav__title" for="nav-7">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Misc
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="Misc/Summary-Misc.html" title="Summary" class="md-nav__link">
Summary
</a>
</li>
<li class="md-nav__item">
<a href="Misc/windows.html" title="Windows" class="md-nav__link">
Windows
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="nav-8" type="checkbox" id="nav-8">
<label class="md-nav__link" for="nav-8">
Tools
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
</span>
</label>
<nav class="md-nav" aria-label="Tools" data-md-level="1">
<label class="md-nav__title" for="nav-8">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Tools
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="Tools/New.html" title="New Note" class="md-nav__link">
New Note
</a>
</li>
<li class="md-nav__item">
<a href="tools/BackLinks.html" title="Display Back Links" class="md-nav__link">
Display Back Links
</a>
</li>
<li class="md-nav__item">
<a href="tools/New.html" title="New Note" class="md-nav__link">
New Note
</a>
</li>
<li class="md-nav__item">
<a href="tools/Summary.html" title="Summary" class="md-nav__link">
Summary
</a>
</li>
<li class="md-nav__item">
<a href="tools/webtitle.html" title="Print Web Title" class="md-nav__link">
Print Web Title
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="nav-9" type="checkbox" id="nav-9">
<label class="md-nav__link" for="nav-9">
Tags
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
</span>
</label>
<nav class="md-nav" aria-label="Tags" data-md-level="1">
<label class="md-nav__title" for="nav-9">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Tags
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="tags/Filter.html" title="Filter" class="md-nav__link">
Filter
</a>
</li>
<li class="md-nav__item">
<a href="tags/create.html" title="Create" class="md-nav__link">
Create
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Table of contents
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#what-does-it-do" class="md-nav__link">
What does it do
</a>
</li>
<li class="md-nav__item">
<a href="#how-do-i-use-it" class="md-nav__link">
How Do I use it
</a>
<nav class="md-nav" aria-label="How Do I use it">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#keyboard-shortcuts" class="md-nav__link">
Keyboard Shortcuts
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#when-would-this-be-used" class="md-nav__link">
When Would This Be Used
</a>
<nav class="md-nav" aria-label="When Would This Be Used">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#example" class="md-nav__link">
Example
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#how-does-it-work" class="md-nav__link">
How does it Work
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset">
<h1>Search</h1>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Start this with <code>cadmus search</code></p>
</div>
<h2 id="what-does-it-do">What does it do<a class="headerlink" href="#what-does-it-do" title="Permanent link">&para;</a></h2>
<p>This starts a search dialog with a preview of the note on the side.</p>
<h2 id="how-do-i-use-it">How Do I use it<a class="headerlink" href="#how-do-i-use-it" title="Permanent link">&para;</a></h2>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This requires <a href="https://www.lesbonscomptes.com/recoll/">recoll</a> set up to index your notes directory.</p>
</div>
<p>After running the command type in a query just like you would with <em>Google</em>, matches will be presented with an instant preview to the side.</p>
<p>Press <kbd>Ctrl</kbd>+<kbd>Q</kbd> to toggle search inside the note for a string (there will <strong>not</strong> be highlighting) <sup id="fnref:9"><a class="footnote-ref" href="#fn:9">1</a></sup></p>
<p>Pressing Enter on a note will open it in the default app, <sup id="fnref:1"><a class="footnote-ref" href="#fn:1">2</a></sup> if you want to do something else with it copy the path to the clipboard with <kbd>Alt</kbd>+<kbd>w</kbd> as described below in <a href="#keyboard-shortcuts">Keyboard Shortcuts</a>.</p>
<h3 id="keyboard-shortcuts">Keyboard Shortcuts<a class="headerlink" href="#keyboard-shortcuts" title="Permanent link">&para;</a></h3>
<table>
<thead>
<tr>
<th>Keys</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><kbd>PgUp</kbd> / <kbd>PgDn</kbd></td>
<td>Scroll Preview</td>
</tr>
<tr>
<td><kbd>Ctrl</kbd>-<kbd>w</kbd></td>
<td>Copy Absolute path to note <sup id="fnref:2"><a class="footnote-ref" href="#fn:2">3</a></sup></td>
</tr>
<tr>
<td><kbd>Alt</kbd>-<kbd>w</kbd></td>
<td>Copy Relative path to note</td>
</tr>
<tr>
<td><kbd>Ctrl</kbd>-<kbd>o</kbd></td>
<td>Open the note in the default app without exiting</td>
</tr>
<tr>
<td><kbd>Alt</kbd>-<kbd>y</kbd></td>
<td>Copy File Contents to Clipboard <sup id="fnref:3"><a class="footnote-ref" href="#fn:3">4</a></sup></td>
</tr>
</tbody>
</table>
<h2 id="when-would-this-be-used">When Would This Be Used<a class="headerlink" href="#when-would-this-be-used" title="Permanent link">&para;</a></h2>
<p>Imagine you're sitting at your desk and this time you need to, solve a linear recurrence relation, you're solution is <code>cadmus search</code> and then type something like <code>linear recursion</code> then <kbd>Ctrl</kbd>-<kbd>Q</kbd> <code>math mod</code>.</p>
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h3>
<h2 id="how-does-it-work">How does it Work<a class="headerlink" href="#how-does-it-work" title="Permanent link">&para;</a></h2>
<p>So essentially this just uses <sub>skim</sub> and <sub>bat</sub> to filter/preview the notes, the interactive command is used with <sub>ripgrep</sub> and piping (that took me forever to figure out!!) to highlight the match in the preview.<sup id="fnref:4"><a class="footnote-ref" href="#fn:4">5</a></sup> This is the code that achieves it:</p>
<div class="highlight"><pre><span></span><code> sk -m -i -c <span class="s1">&#39;recoll -b -t -q &quot;ext:md&quot; {} |\</span>
<span class="s1"> cut -c 8- | sed s/^/realpath\ \&quot;/ |\</span>
<span class="s1"> sed s+\$+\&quot;\ --relative-to\ \&quot;./\&quot;+ | bash&#39;</span> <span class="se">\</span>
--bind pgup:preview-page-up,pgdn:preview-page-down <span class="se">\</span>
--preview <span class="s2">&quot;bat --color=always --line-range :500 \</span>
<span class="s2"> --terminal-width 80 --theme=TwoDark {+} \</span>
<span class="s2"> --italic-text=always \</span>
<span class="s2"> --decorations=always&quot;</span> <span class="se">\</span>
--color<span class="o">=</span>fg:#f8f8f2,bg:-1,matched:#6272a4,current_fg:#50fa7b,current_bg:#381070,border:#ff79c6,prompt:#bd93f9,query:#bd93f9,marker:#f1fa8c,header:#f1fa8c
</code></pre></div>
<div class="footnote">
<hr />
<ol>
<li id="fn:9">
<p>The distinction between this and find is essentially the distinction between <code>grep</code> and a search engine.&#160;<a class="footnote-backref" href="#fnref:9" title="Jump back to footnote 1 in the text">&#8617;</a></p>
</li>
<li id="fn:1">
<p><code>xdg-open</code> / <code>open</code> on Linux/Mac respectively&#160;<a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 2 in the text">&#8617;</a></p>
</li>
<li id="fn:2">
<p>TODO: this only works on Xorg at the moment&#160;<a class="footnote-backref" href="#fnref:2" title="Jump back to footnote 3 in the text">&#8617;</a></p>
</li>
<li id="fn:3">
<p>This is really good for <em>Zulip</em> / <em>Discord</em>&#160;<a class="footnote-backref" href="#fnref:3" title="Jump back to footnote 4 in the text">&#8617;</a></p>
</li>
<li id="fn:4">
<p>This highlighting works with both <sub>bat</sub> and <em>MDCat</em>, I prefer <em>MDCat</em> but there is a bug with footnotes preventing me from being able to use it right at the moment.&#160;<a class="footnote-backref" href="#fnref:4" title="Jump back to footnote 5 in the text">&#8617;</a></p>
</li>
</ol>
</div>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid" aria-label="Footer">
<a href="preview.html" title="Search" class="md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-footer-nav__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</div>
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Search
</div>
</div>
</a>
<a href="Misc/Summary-Misc.html" title="Summary" class="md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Summary
</div>
</div>
<div class="md-footer-nav__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<script src="assets/javascripts/vendor.d710d30a.min.js"></script>
<script src="assets/javascripts/bundle.7f4f3c92.min.js"></script><script id="__lang" type="application/json">{"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents"}</script>
<script>
app = initialize({
base: ".",
features: [],
search: Object.assign({
worker: "assets/javascripts/worker/search.9b3611bd.min.js"
}, typeof search !== "undefined" && search)
})
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script>
</body>
</html>