Deploying to gh-pages from @ TxtDot/documentation@97f52649e6 🚀

This commit is contained in:
artegoser 2024-05-27 09:35:13 +00:00
parent d742c1a03e
commit 97c061a043
8 changed files with 257 additions and 378 deletions

View file

@ -241,7 +241,7 @@
<li class="md-nav__item">
<a href="/." class="md-nav__link">
<a href="/index.md" class="md-nav__link">
<span class="md-ellipsis">
@ -260,7 +260,7 @@
<li class="md-nav__item">
<a href="/selfhost/" class="md-nav__link">
<a href="/selfhost.md" class="md-nav__link">
<span class="md-ellipsis">
@ -279,7 +279,7 @@
<li class="md-nav__item">
<a href="/docker/" class="md-nav__link">
<a href="/docker.md" class="md-nav__link">
<span class="md-ellipsis">
@ -298,7 +298,7 @@
<li class="md-nav__item">
<a href="/env/" class="md-nav__link">
<a href="/env.md" class="md-nav__link">
<span class="md-ellipsis">
@ -317,7 +317,7 @@
<li class="md-nav__item">
<a href="/reverse/" class="md-nav__link">
<a href="/reverse.md" class="md-nav__link">
<span class="md-ellipsis">

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -9,13 +9,9 @@
<link rel="prev" href="../selfhost/">
<link rel="next" href="../env/">
<link rel="icon" href="../assets/images/favicon.png">
<link rel="icon" href="../../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.2, mkdocs-material-9.2.5">
@ -24,10 +20,10 @@
<link rel="stylesheet" href="../assets/stylesheets/main.0e669242.min.css">
<link rel="stylesheet" href="../../../assets/stylesheets/main.0e669242.min.css">
<link rel="stylesheet" href="../assets/stylesheets/palette.85d0ee34.min.css">
<link rel="stylesheet" href="../../../assets/stylesheets/palette.85d0ee34.min.css">
@ -46,7 +42,7 @@
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
<script>__md_scope=new URL("../../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
@ -91,7 +87,7 @@
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href=".." title="txtdot" class="md-header__button md-logo" aria-label="txtdot" data-md-component="logo">
<a href="../../.." title="txtdot" class="md-header__button md-logo" aria-label="txtdot" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 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>
@ -221,7 +217,7 @@
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="txtdot" class="md-nav__button md-logo" aria-label="txtdot" data-md-component="logo">
<a href="../../.." title="txtdot" class="md-nav__button md-logo" aria-label="txtdot" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 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>
@ -250,7 +246,7 @@
<li class="md-nav__item">
<a href=".." class="md-nav__link">
<a href="../../../index.md" class="md-nav__link">
<span class="md-ellipsis">
@ -269,7 +265,7 @@
<li class="md-nav__item">
<a href="../selfhost/" class="md-nav__link">
<a href="../../../selfhost.md" class="md-nav__link">
<span class="md-ellipsis">
@ -286,18 +282,9 @@
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<a href="./" class="md-nav__link md-nav__link--active">
<li class="md-nav__item">
<a href="../../../docker.md" class="md-nav__link">
<span class="md-ellipsis">
@ -306,7 +293,6 @@
</a>
</li>
@ -317,7 +303,7 @@
<li class="md-nav__item">
<a href="../env/" class="md-nav__link">
<a href="../../../env.md" class="md-nav__link">
<span class="md-ellipsis">
@ -336,7 +322,7 @@
<li class="md-nav__item">
<a href="../reverse/" class="md-nav__link">
<a href="../../../reverse.md" class="md-nav__link">
<span class="md-ellipsis">
@ -434,10 +420,10 @@ the <code>environment</code> section of docker-compose config
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script id="__config" type="application/json">{"base": "../../..", "features": [], "search": "../../../assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script src="../assets/javascripts/bundle.78eede0e.min.js"></script>
<script src="../../../assets/javascripts/bundle.78eede0e.min.js"></script>
</body>

View file

@ -9,13 +9,9 @@
<link rel="prev" href="../docker/">
<link rel="next" href="../reverse/">
<link rel="icon" href="../assets/images/favicon.png">
<link rel="icon" href="../../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.2, mkdocs-material-9.2.5">
@ -24,10 +20,10 @@
<link rel="stylesheet" href="../assets/stylesheets/main.0e669242.min.css">
<link rel="stylesheet" href="../../../assets/stylesheets/main.0e669242.min.css">
<link rel="stylesheet" href="../assets/stylesheets/palette.85d0ee34.min.css">
<link rel="stylesheet" href="../../../assets/stylesheets/palette.85d0ee34.min.css">
@ -46,7 +42,7 @@
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
<script>__md_scope=new URL("../../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
@ -91,7 +87,7 @@
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href=".." title="txtdot" class="md-header__button md-logo" aria-label="txtdot" data-md-component="logo">
<a href="../../.." title="txtdot" class="md-header__button md-logo" aria-label="txtdot" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 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>
@ -221,7 +217,7 @@
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="txtdot" class="md-nav__button md-logo" aria-label="txtdot" data-md-component="logo">
<a href="../../.." title="txtdot" class="md-nav__button md-logo" aria-label="txtdot" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 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>
@ -250,7 +246,7 @@
<li class="md-nav__item">
<a href=".." class="md-nav__link">
<a href="../../../index.md" class="md-nav__link">
<span class="md-ellipsis">
@ -269,7 +265,7 @@
<li class="md-nav__item">
<a href="../selfhost/" class="md-nav__link">
<a href="../../../selfhost.md" class="md-nav__link">
<span class="md-ellipsis">
@ -288,7 +284,7 @@
<li class="md-nav__item">
<a href="../docker/" class="md-nav__link">
<a href="../../../docker.md" class="md-nav__link">
<span class="md-ellipsis">
@ -305,29 +301,9 @@
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Configuring
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<li class="md-nav__item">
<a href="../../../env.md" class="md-nav__link">
<span class="md-ellipsis">
@ -336,61 +312,6 @@
</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"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#host" class="md-nav__link">
HOST
</a>
</li>
<li class="md-nav__item">
<a href="#port" class="md-nav__link">
PORT
</a>
</li>
<li class="md-nav__item">
<a href="#reverse_proxy" class="md-nav__link">
REVERSE_PROXY
</a>
</li>
<li class="md-nav__item">
<a href="#proxy_res" class="md-nav__link">
PROXY_RES
</a>
</li>
<li class="md-nav__item">
<a href="#swagger" class="md-nav__link">
SWAGGER
</a>
</li>
</ul>
</nav>
</li>
@ -401,7 +322,7 @@
<li class="md-nav__item">
<a href="../reverse/" class="md-nav__link">
<a href="../../../reverse.md" class="md-nav__link">
<span class="md-ellipsis">
@ -441,38 +362,118 @@
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#server-settings" class="md-nav__link">
Server Settings
</a>
<nav class="md-nav" aria-label="Server Settings">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#host" class="md-nav__link">
HOST
</a>
</li>
<li class="md-nav__item">
<li class="md-nav__item">
<a href="#port" class="md-nav__link">
PORT
</a>
</li>
<li class="md-nav__item">
<li class="md-nav__item">
<a href="#timeout" class="md-nav__link">
Timeout
</a>
</li>
<li class="md-nav__item">
<a href="#reverse_proxy" class="md-nav__link">
REVERSE_PROXY
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#proxy" class="md-nav__link">
Proxy
</a>
<nav class="md-nav" aria-label="Proxy">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#proxy_res" class="md-nav__link">
PROXY_RES
</a>
</li>
<li class="md-nav__item">
<a href="#img_compress" class="md-nav__link">
IMG_COMPRESS
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#documentation" class="md-nav__link">
Documentation
</a>
<nav class="md-nav" aria-label="Documentation">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#swagger" class="md-nav__link">
SWAGGER
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#third-party" class="md-nav__link">
Third-party
</a>
<nav class="md-nav" aria-label="Third-party">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#searx_url" class="md-nav__link">
SEARX_URL
</a>
</li>
<li class="md-nav__item">
<a href="#webder_url" class="md-nav__link">
WEBDER_URL
</a>
</li>
</ul>
</nav>
</li>
</ul>
@ -497,25 +498,39 @@
<p>txtdot can be configured either with environment variables
or with the <code>.env</code> file in the working directory which has higher priority.
For sample config, see <a href="https://github.com/TxtDot/txtdot/blob/main/.env.example"><code>.env.example</code></a>.</p>
<h2 id="host">HOST</h2>
<h2 id="server-settings">Server Settings</h2>
<h3 id="host">HOST</h3>
<p>Default: <code>0.0.0.0</code></p>
<p>Host where HTTP server should listen for connections.
Set it to <code>127.0.0.1</code> if your txtdot instance is behind reverse proxy,
<code>0.0.0.0</code> otherwise.</p>
<h2 id="port">PORT</h2>
<h3 id="port">PORT</h3>
<p>Default: <code>8080</code></p>
<p>Port where HTTP server should listen for connections.</p>
<h2 id="reverse_proxy">REVERSE_PROXY</h2>
<h3 id="timeout">Timeout</h3>
<p>Default: <code>0</code></p>
<p>Max response time in milliseconds. If it's reached, the request is aborted. If set to <code>0</code>, the timeout is disabled.</p>
<h3 id="reverse_proxy">REVERSE_PROXY</h3>
<p>Default: <code>false</code></p>
<p>Set it to <code>true</code> only if your txtdot instance runs behind reverse proxy.
Needed for processing X-Forwarded headers.</p>
<h2 id="proxy_res">PROXY_RES</h2>
<h2 id="proxy">Proxy</h2>
<h3 id="proxy_res">PROXY_RES</h3>
<p>Default: <code>true</code></p>
<p>Whether to allow proxying images, video, audio
and everything else through your txtdot instance.</p>
<h2 id="swagger">SWAGGER</h2>
<h3 id="img_compress">IMG_COMPRESS</h3>
<p>Default: <code>true</code></p>
<p>Whether to compress images through your txtdot instance.</p>
<h2 id="documentation">Documentation</h2>
<h3 id="swagger">SWAGGER</h3>
<p>Default: <code>false</code></p>
<p>Whether to add <code>/doc</code> route for Swagger API docs.</p>
<h2 id="third-party">Third-party</h2>
<h3 id="searx_url">SEARX_URL</h3>
<p>SearXNG base URL, if set, txtdot will use it for searching and add search form to the page with /search route.</p>
<h3 id="webder_url">WEBDER_URL</h3>
<p>Webder base URL, if set, txtdot will use it for rendering web pages.</p>
@ -553,10 +568,10 @@ and everything else through your txtdot instance.</p>
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script id="__config" type="application/json">{"base": "../../..", "features": [], "search": "../../../assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script src="../assets/javascripts/bundle.78eede0e.min.js"></script>
<script src="../../../assets/javascripts/bundle.78eede0e.min.js"></script>
</body>

View file

@ -10,22 +10,20 @@
<link rel="next" href="selfhost/">
<link rel="icon" href="assets/images/favicon.png">
<link rel="icon" href="../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.2, mkdocs-material-9.2.5">
<title>txtdot</title>
<title>Getting Started - txtdot</title>
<link rel="stylesheet" href="assets/stylesheets/main.0e669242.min.css">
<link rel="stylesheet" href="../../assets/stylesheets/main.0e669242.min.css">
<link rel="stylesheet" href="assets/stylesheets/palette.85d0ee34.min.css">
<link rel="stylesheet" href="../../assets/stylesheets/palette.85d0ee34.min.css">
@ -44,7 +42,7 @@
<script>__md_scope=new URL(".",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
<script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
@ -89,7 +87,7 @@
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="." title="txtdot" class="md-header__button md-logo" aria-label="txtdot" data-md-component="logo">
<a href="../.." title="txtdot" class="md-header__button md-logo" aria-label="txtdot" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 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>
@ -219,7 +217,7 @@
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="." title="txtdot" class="md-nav__button md-logo" aria-label="txtdot" data-md-component="logo">
<a href="../.." title="txtdot" class="md-nav__button md-logo" aria-label="txtdot" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 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>
@ -246,29 +244,9 @@
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Getting Started
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="." class="md-nav__link md-nav__link--active">
<li class="md-nav__item">
<a href="../../index.md" class="md-nav__link">
<span class="md-ellipsis">
@ -277,47 +255,6 @@
</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"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#what-is-this" class="md-nav__link">
What is this
</a>
</li>
<li class="md-nav__item">
<a href="#how-to-use-it" class="md-nav__link">
How to use it
</a>
</li>
<li class="md-nav__item">
<a href="#how-it-works" class="md-nav__link">
How it works
</a>
</li>
</ul>
</nav>
</li>
@ -328,7 +265,7 @@
<li class="md-nav__item">
<a href="selfhost/" class="md-nav__link">
<a href="../../selfhost.md" class="md-nav__link">
<span class="md-ellipsis">
@ -347,7 +284,7 @@
<li class="md-nav__item">
<a href="docker/" class="md-nav__link">
<a href="../../docker.md" class="md-nav__link">
<span class="md-ellipsis">
@ -366,7 +303,7 @@
<li class="md-nav__item">
<a href="env/" class="md-nav__link">
<a href="../../env.md" class="md-nav__link">
<span class="md-ellipsis">
@ -385,7 +322,7 @@
<li class="md-nav__item">
<a href="reverse/" class="md-nav__link">
<a href="../../reverse.md" class="md-nav__link">
<span class="md-ellipsis">
@ -443,6 +380,33 @@
How it works
</a>
<nav class="md-nav" aria-label="How it works">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#plugins" class="md-nav__link">
Plugins
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#engines" class="md-nav__link">
Engines
</a>
</li>
<li class="md-nav__item">
<a href="#middlewares" class="md-nav__link">
Middlewares
</a>
</li>
</ul>
@ -492,18 +456,60 @@ are ratelimited to 2 requests per second.</p>
The initial idea was to process HTML with it on the server
so the client does not need to download and execute heavy JS,
doesn't need to use an adblock.</p>
<p>Readability performs its work very well in most cases.
But not always. For example, check any StackOverflow page or Google search results.</p>
<p>So <a href="https://github.com/artegoser">artegoser</a> wrote the basis of the code
keeping in mind that we'll extend txtdot with other <em>engines</em>.
For now, engines are functions taking a URL as a parameter,
returning an object that contains extracted HTML and plain text, page title and language.
The object is rendered with ejs template (or, in <code>/api/parse</code>, just sent as JSON).</p>
<p>Readability performs its work very well in most cases.</p>
<p>If an <code>?engine=</code> parameter wasn't passed, but txtdot found
that a specific engine is assigned to the requested domain,
for example, <code>"stackoverflow.com": stackoverflow</code>,
for example, <code>"stackoverflow.com": engines.StackOverflow</code>,
it uses that engine to process the URL.
Otherwise, the page is parsed with the engine assigned to <code>*</code> (it's Readability).</p>
<h3 id="plugins">Plugins</h3>
<p>Readability is good, but now always, so <a href="https://github.com/artegoser">artegoser</a> wrote the basis of the code
keeping in mind that we'll extend txtdot with other <em>engines</em>.
Back then, it was functions taking a URL as a parameter,
returning an object that contains extracted HTML and plain text, page title and language.
The object is rendered with ejs template (or, in <code>/api/parse</code>, just sent as JSON).</p>
<p>But after a while it became unwieldy and we decided to create a monorepo. We created classes Engines, Middlewares that handle the necessary parts. Now you can create such functions for different domains, and routes. Also we added support for JSX for simplifying the code of plugins.</p>
<h2 id="engines">Engines</h2>
<p>Creation of engines is easy.</p>
<pre><code class="language-ts">import { Engine, Route } from &quot;@txtdot/sdk&quot;;
const Readability = new Engine(
&quot;Readability&quot;, // Name of the engine
&quot;Engine for parsing content with Readability&quot;, // Description
[&quot;*&quot;] // Domains that use this engine
);
Readability.route(&quot;*path&quot;, async (input, ro: Route&lt;{ path: string }&gt;) =&gt; {
// ...
// If any of the parameters except content is empty, txtdot will try to extract it from the page automatically
return {
content: parsed.content,
title: parsed.title,
lang: parsed.lang,
};
});
</code></pre>
<h2 id="middlewares">Middlewares</h2>
<p>Creation of middlewares similar to engines.</p>
<pre><code class="language-tsx">import { Middleware } from &quot;@txtdot/sdk&quot;;
const Highlight = new Middleware(
&quot;Highlight&quot;,
&quot;Highlights code with highlight.js only when needed&quot;,
[&quot;*&quot;]
);
Highlight.use(async (input, ro, out) =&gt; {
if (out.content.indexOf(&quot;&lt;code&quot;) !== -1)
return {
...out,
content: &lt;Highlighter content={out.content} /&gt;,
};
return out;
});
</code></pre>
@ -541,10 +547,10 @@ Otherwise, the page is parsed with the engine assigned to <code>*</code> (it's R
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": ".", "features": [], "search": "assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script id="__config" type="application/json">{"base": "../..", "features": [], "search": "../../assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script src="assets/javascripts/bundle.78eede0e.min.js"></script>
<script src="../../assets/javascripts/bundle.78eede0e.min.js"></script>
</body>

View file

@ -9,11 +9,9 @@
<link rel="prev" href="../env/">
<link rel="icon" href="../assets/images/favicon.png">
<link rel="icon" href="../../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.2, mkdocs-material-9.2.5">
@ -22,10 +20,10 @@
<link rel="stylesheet" href="../assets/stylesheets/main.0e669242.min.css">
<link rel="stylesheet" href="../../../assets/stylesheets/main.0e669242.min.css">
<link rel="stylesheet" href="../assets/stylesheets/palette.85d0ee34.min.css">
<link rel="stylesheet" href="../../../assets/stylesheets/palette.85d0ee34.min.css">
@ -44,7 +42,7 @@
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
<script>__md_scope=new URL("../../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
@ -89,7 +87,7 @@
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href=".." title="txtdot" class="md-header__button md-logo" aria-label="txtdot" data-md-component="logo">
<a href="../../.." title="txtdot" class="md-header__button md-logo" aria-label="txtdot" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 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>
@ -219,7 +217,7 @@
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="txtdot" class="md-nav__button md-logo" aria-label="txtdot" data-md-component="logo">
<a href="../../.." title="txtdot" class="md-nav__button md-logo" aria-label="txtdot" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 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>
@ -248,7 +246,7 @@
<li class="md-nav__item">
<a href=".." class="md-nav__link">
<a href="../../../index.md" class="md-nav__link">
<span class="md-ellipsis">
@ -267,7 +265,7 @@
<li class="md-nav__item">
<a href="../selfhost/" class="md-nav__link">
<a href="../../../selfhost.md" class="md-nav__link">
<span class="md-ellipsis">
@ -286,7 +284,7 @@
<li class="md-nav__item">
<a href="../docker/" class="md-nav__link">
<a href="../../../docker.md" class="md-nav__link">
<span class="md-ellipsis">
@ -305,7 +303,7 @@
<li class="md-nav__item">
<a href="../env/" class="md-nav__link">
<a href="../../../env.md" class="md-nav__link">
<span class="md-ellipsis">
@ -322,29 +320,9 @@
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Reverse Proxy
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<li class="md-nav__item">
<a href="../../../reverse.md" class="md-nav__link">
<span class="md-ellipsis">
@ -353,40 +331,6 @@
</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"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#nginx" class="md-nav__link">
Nginx
</a>
</li>
<li class="md-nav__item">
<a href="#apache" class="md-nav__link">
Apache
</a>
</li>
</ul>
</nav>
</li>
@ -571,10 +515,10 @@ and open a <a href="https://github.com/txtdot/documentation/pulls">pull request<
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script id="__config" type="application/json">{"base": "../../..", "features": [], "search": "../../../assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script src="../assets/javascripts/bundle.78eede0e.min.js"></script>
<script src="../../../assets/javascripts/bundle.78eede0e.min.js"></script>
</body>

View file

@ -9,13 +9,9 @@
<link rel="prev" href="..">
<link rel="next" href="../docker/">
<link rel="icon" href="../assets/images/favicon.png">
<link rel="icon" href="../../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.2, mkdocs-material-9.2.5">
@ -24,10 +20,10 @@
<link rel="stylesheet" href="../assets/stylesheets/main.0e669242.min.css">
<link rel="stylesheet" href="../../../assets/stylesheets/main.0e669242.min.css">
<link rel="stylesheet" href="../assets/stylesheets/palette.85d0ee34.min.css">
<link rel="stylesheet" href="../../../assets/stylesheets/palette.85d0ee34.min.css">
@ -46,7 +42,7 @@
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
<script>__md_scope=new URL("../../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
@ -91,7 +87,7 @@
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href=".." title="txtdot" class="md-header__button md-logo" aria-label="txtdot" data-md-component="logo">
<a href="../../.." title="txtdot" class="md-header__button md-logo" aria-label="txtdot" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 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>
@ -221,7 +217,7 @@
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="txtdot" class="md-nav__button md-logo" aria-label="txtdot" data-md-component="logo">
<a href="../../.." title="txtdot" class="md-nav__button md-logo" aria-label="txtdot" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 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>
@ -250,7 +246,7 @@
<li class="md-nav__item">
<a href=".." class="md-nav__link">
<a href="../../../index.md" class="md-nav__link">
<span class="md-ellipsis">
@ -267,29 +263,9 @@
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Self-Hosting
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<li class="md-nav__item">
<a href="../../../selfhost.md" class="md-nav__link">
<span class="md-ellipsis">
@ -298,54 +274,6 @@
</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"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#install-nodejs-and-npm" class="md-nav__link">
Install nodejs and npm
</a>
</li>
<li class="md-nav__item">
<a href="#create-a-user-for-txtdot" class="md-nav__link">
Create a user for txtdot
</a>
</li>
<li class="md-nav__item">
<a href="#build-config-and-launch" class="md-nav__link">
Build, config and launch
</a>
</li>
<li class="md-nav__item">
<a href="#add-txtdot-to-autostart" class="md-nav__link">
Add txtdot to autostart
</a>
</li>
</ul>
</nav>
</li>
@ -356,7 +284,7 @@
<li class="md-nav__item">
<a href="../docker/" class="md-nav__link">
<a href="../../../docker.md" class="md-nav__link">
<span class="md-ellipsis">
@ -375,7 +303,7 @@
<li class="md-nav__item">
<a href="../env/" class="md-nav__link">
<a href="../../../env.md" class="md-nav__link">
<span class="md-ellipsis">
@ -394,7 +322,7 @@
<li class="md-nav__item">
<a href="../reverse/" class="md-nav__link">
<a href="../../../reverse.md" class="md-nav__link">
<span class="md-ellipsis">
@ -584,10 +512,10 @@ doas rc-service txtdot start
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script id="__config" type="application/json">{"base": "../../..", "features": [], "search": "../../../assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script src="../assets/javascripts/bundle.78eede0e.min.js"></script>
<script src="../../../assets/javascripts/bundle.78eede0e.min.js"></script>
</body>