1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00
joplin/packages/app-cli/tests/html_to_md/code_multiline_3.html
wljince007 294cc4a440
Desktop: Fixes #5626: When web clipper clipping code blocks, keep code in multiline and delete code number lines (#10126)
Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
Co-authored-by: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com>
2024-04-20 13:48:44 +01:00

2 lines
8.0 KiB
HTML

<!-- this is from: https://joplinapp.org/help/api/tutorials/toc_plugin/ -->
<pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar" style="font-family: SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace;"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token comment" style="color: rgb(153, 153, 136); font-style: italic; --darkreader-inline-color: #a29a8e;" data-darkreader-inline-color="">// Import the Joplin API</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain"></span><span class="token keyword" style="color: rgb(0, 0, 159); --darkreader-inline-color: #6da2ff;" data-darkreader-inline-color="">import</span><span class="token plain"> joplin </span><span class="token keyword" style="color: rgb(0, 0, 159); --darkreader-inline-color: #6da2ff;" data-darkreader-inline-color="">from</span><span class="token plain"> </span><span class="token string" style="color: rgb(227, 17, 108); --darkreader-inline-color: #f03183;" data-darkreader-inline-color="">'api'</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">;</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain"></span><span class="token comment" style="color: rgb(153, 153, 136); font-style: italic; --darkreader-inline-color: #a29a8e;" data-darkreader-inline-color="">// Register the plugin</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain">joplin</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">.</span><span class="token plain">plugins</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">.</span><span class="token function" style="color: rgb(215, 58, 73); --darkreader-inline-color: #da4b58;" data-darkreader-inline-color="">register</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">(</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain"> </span><span class="token comment" style="color: rgb(153, 153, 136); font-style: italic; --darkreader-inline-color: #a29a8e;" data-darkreader-inline-color="">// Run initialisation code in the onStart event handler</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain"> </span><span class="token comment" style="color: rgb(153, 153, 136); font-style: italic; --darkreader-inline-color: #a29a8e;" data-darkreader-inline-color="">// Note that due to the plugin multi-process architecture, you should</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain"> </span><span class="token comment" style="color: rgb(153, 153, 136); font-style: italic; --darkreader-inline-color: #a29a8e;" data-darkreader-inline-color="">// always assume that all function calls and event handlers are async.</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain"> </span><span class="token function-variable function" style="color: rgb(215, 58, 73); --darkreader-inline-color: #da4b58;" data-darkreader-inline-color="">onStart</span><span class="token operator" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">:</span><span class="token plain"> </span><span class="token keyword" style="color: rgb(0, 0, 159); --darkreader-inline-color: #6da2ff;" data-darkreader-inline-color="">async</span><span class="token plain"> </span><span class="token keyword" style="color: rgb(0, 0, 159); --darkreader-inline-color: #6da2ff;" data-darkreader-inline-color="">function</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">(</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">)</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">.</span><span class="token function" style="color: rgb(215, 58, 73); --darkreader-inline-color: #da4b58;" data-darkreader-inline-color="">info</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">(</span><span class="token string" style="color: rgb(227, 17, 108); --darkreader-inline-color: #f03183;" data-darkreader-inline-color="">'TOC plugin started!'</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">)</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">;</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain"> </span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">}</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color=""><span class="token plain"></span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">}</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">)</span><span class="token punctuation" style="color: rgb(57, 58, 52); --darkreader-inline-color: #c5c0b9;" data-darkreader-inline-color="">;</span><br></span></code></pre>