Skip to content

YuxinZhaozyx/siyuan-embed-pseudocode

Repository files navigation

Pseudocode

SiYuan Plugin「Embed Series」
Elegantly Writing and Displaying Pseudocode in SiYuan using LaTeX algorithm syntax.
No external dependencies · Full editability · Free to share

中文 | English


Embed Series

This plugin is an upgraded version of the Pseudocode Widget (siyuan-pseudocode), and serves as the second plugin in the Embed Series, aiming to provide a more complete and flexible Pseudocode experience within SiYuan.

The principle of Embed Series plugins: They are designed solely as auxiliary editing tools for SiYuan, embedding all information directly into formats supported by SiYuan and Markdown. This ensures that all content created by the plugin remains fully visible and functional even after being separated from the plugin — or even from SiYuan itself — such as when exporting to Markdown or sharing on third-party platforms.

For users of the original Pseudocode Widget, this plugin provides a one-click migration feature to help you quickly transition. For detailed steps, please refer to the Usage Guide section below.

Effects

Pseudocode Source Code
\begin{algorithm}
\caption{Quicksort}
\begin{algorithmic}
\PROCEDURE{Quicksort}{$A, p, r$}
    \IF{$p < r$} 
        \STATE $q = $ \CALL{Partition}{$A, p, r$}
        \STATE \CALL{Quicksort}{$A, p, q - 1$}
        \STATE \CALL{Quicksort}{$A, q + 1, r$}
    \ENDIF
\ENDPROCEDURE
\PROCEDURE{Partition}{$A, p, r$}
    \STATE $x = A[r]$
    \STATE $i = p - 1$
    \FOR{$j = p$ \TO $r - 1$}
        \IF{$A[j] < x$}
            \STATE $i = i + 1$
            \STATE exchange
            $A[i]$ with $A[j]$
        \ENDIF
        \STATE exchange $A[i]$ with $A[r]$
    \ENDFOR
\ENDPROCEDURE
\end{algorithmic}
\end{algorithm}

image.png

Features

  • Offline usage (no internet required)
  • CodeMirror editor (syntax highlighting, auto-completion, error hints)
  • Configure rendering style
  • Store pseudocode in markdown native code blocks
  • PDF export support

If you have additional feature requests or suggestions, feel free to open an issue on GitHub or post in the SiYuan community.

Usage Guide

Create Pseudocode:
Type /pseudoode in the editor to create a pseudocode block.

Edit Pseudocode:
Click the menu button in the left side / top-right corner of the code block. If the block is recognized as a valid pseudocode block, an Edit Pseudocode option will appear. Click it to open the editor.

Switch Pseudocode View: Click the menu button in the left side / top-right corner of the code block. If the block is recognized as a valid pseudocode block, an Enable Pseudocode View / Disable Pseudocode View option will appear. Click it to switch between pseudocode view and normal code block.

Migrate from Pseudocode Widget:
Click the menu button on the left side of a Pseudocode Widget block. An option labeled Convert to Embed Pseudocode will appear. Click it to convert the old widget block into a new Embed Series pseudocode block.

Changelog

  • v0.5.8
    • Add QQ group
  • v0.5.7
    • Fix: render fail when turn on codeblock line numbers
  • v0.5.6
    • change SiYuan version requirements: >=3.0.0
  • v0.5.5
    • Fix: cut and paste pseudocode code will copy the HTML
    • Feature: type /伪代码 can also create a new pseudocode block
  • v0.5.4
    • Update plugin name
  • v0.5.3
    • Fix: render existed pseudocode code fail when boot plugin
    • Optimize: optimize linter of editor
  • v0.5.2
    • Fix: need manual refresh when load and unload plugin
    • Fix: pseudocode block view is editable
  • v0.5.1
    • Fix: compile always fails
    • Feature: PDF export support
  • v0.5.0
    • Inherits all core features from the original Pseudocode Widget (siyuan-pseudocode)
    • Added ability to edit and show pseudocode via the top-right menu button
    • One-click migration from the original Pseudocode Widget
    • Dark mode support

About

思源笔记的嵌入式伪代码插件

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors