Skip to content

Commit 4ced3ab

Browse files
committed
Deployed 07c15a2 to 2024.4.1 with MkDocs 1.6.0 and mike 1.1.2
1 parent 4c1e8fb commit 4ced3ab

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

2024.4.1/user-guide/editor/index.html

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,17 @@
580580

581581

582582

583+
<label class="md-nav__link md-nav__link--active" for="__toc">
584+
585+
586+
<span class="md-ellipsis">
587+
Python editor
588+
</span>
589+
590+
591+
<span class="md-nav__icon md-icon"></span>
592+
</label>
593+
583594
<a href="./" class="md-nav__link md-nav__link--active">
584595

585596

@@ -590,6 +601,39 @@
590601

591602
</a>
592603

604+
605+
606+
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
607+
608+
609+
610+
611+
612+
613+
<label class="md-nav__title" for="__toc">
614+
<span class="md-nav__icon md-icon"></span>
615+
Table of contents
616+
</label>
617+
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
618+
619+
<li class="md-nav__item">
620+
<a href="#editor-vs-terminal" class="md-nav__link">
621+
Editor VS Terminal
622+
</a>
623+
624+
</li>
625+
626+
<li class="md-nav__item">
627+
<a href="#still-missing" class="md-nav__link">
628+
Still missing
629+
</a>
630+
631+
</li>
632+
633+
</ul>
634+
635+
</nav>
636+
593637
</li>
594638

595639

@@ -682,6 +726,28 @@
682726

683727

684728

729+
<label class="md-nav__title" for="__toc">
730+
<span class="md-nav__icon md-icon"></span>
731+
Table of contents
732+
</label>
733+
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
734+
735+
<li class="md-nav__item">
736+
<a href="#editor-vs-terminal" class="md-nav__link">
737+
Editor VS Terminal
738+
</a>
739+
740+
</li>
741+
742+
<li class="md-nav__item">
743+
<a href="#still-missing" class="md-nav__link">
744+
Still missing
745+
</a>
746+
747+
</li>
748+
749+
</ul>
750+
685751
</nav>
686752
</div>
687753
</div>
@@ -774,6 +840,20 @@ <h1 id="python-editor">Python editor</h1>
774840
</span><span id="__span-3-4"><a id="__codelineno-3-4" name="__codelineno-3-4" href="#__codelineno-3-4"></a><span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
775841
</span><span id="__span-3-5"><a id="__codelineno-3-5" name="__codelineno-3-5" href="#__codelineno-3-5"></a><span class="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;editor&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">div</span><span class="p">&gt;</span> <span class="cm">&lt;!-- will eventually contain the Python editor --&gt;</span>
776842
</span></code></pre></div>
843+
<h2 id="editor-vs-terminal">Editor VS Terminal</h2>
844+
<p>The main difference between these two core plugins is that a <em>py-editor</em>, or <em>mpy-editor</em>, is a custom orchestration a part and editors run in workers by default, mostly to prevent accidental blocking evaluation that could otherwise freeze the main thread UI (infinite loops or similar deadlocks).</p>
845+
<p>Because an editor is detached from the regular orchestration that happens with just <em>py</em> or <em>mpy</em> scripts, one should not expect the same behavior regular <em>PyScript</em> elements follow, most notably:</p>
846+
<ul>
847+
<li>the whole editor is based on <a href="https://codemirror.net/">CodeMirror</a> and not on <em>XTerm.js</em> as it is for the <em>terminal</em></li>
848+
<li>the code is evaluated all at once and <em>always async</em> when the <em>Run</em> button is pressed, not per each line</li>
849+
<li>the editor has listeners for <code>Ctrl-Enter</code>, or <code>Cmd-Enter</code>, plus <code>Shift-Enter</code> to shortcut the execution of the code. These shortcuts make no sense in the <em>terminal</em> as each line matters</li>
850+
<li>there is a clear separation of the input and the resulting output</li>
851+
<li>simple to complex programs can be written without executing</li>
852+
<li>there is no special reference to the underlying editor instance, while there is both <code>script.terminal</code> or <code>__terminal__</code> in the <em>terminal</em> case</li>
853+
</ul>
854+
<h2 id="still-missing">Still missing</h2>
855+
<p>As mentioned at the top of this section, the <em>PyEditor</em> is currently under further development and refinement, and it might land also as explicit custom element such as <code>&lt;py-editor&gt;</code> or <code>&lt;mpy-editor&gt;</code>, somehow simplifying the bootstrap through its content-aware element nature but right now these variants are <em>not</em> supported.</p>
856+
<p>Last, but not least, we currently don't have a mechanism to destroy a terminal or kill its execution from the worker so in case of infinite loops, the easy way out is to refresh the current page so that previous worker would get killed. We will eventually provide an easier way to kill and start fresh in the future.</p>
777857

778858

779859

0 commit comments

Comments
 (0)