No description
Find a file
2023-03-19 16:08:25 +08:00
.github/workflows new release 1.1.2 2023-03-19 13:45:45 +08:00
assets doc: update README 2023-03-13 19:40:56 +08:00
.editorconfig chore: add auto-release workflow 2023-03-19 11:51:32 +08:00
.eslintignore Initial commit 2023-03-13 15:05:19 +08:00
.eslintrc Initial commit 2023-03-13 15:05:19 +08:00
.gitignore chore: inline online fonts with base64 2023-03-16 01:10:59 +08:00
.npmrc Initial commit 2023-03-13 15:05:19 +08:00
esbuild.config.mjs Initial commit 2023-03-13 15:05:19 +08:00
extract_katexcss.py chore: inline online fonts with base64 2023-03-16 01:10:59 +08:00
katex.min.css chore: inline online fonts with base64 2023-03-16 01:10:59 +08:00
LICENSE Create LICENSE 2023-03-13 20:12:41 +08:00
main.ts feat: add FOR to auto-complete 2023-03-19 13:56:21 +08:00
manifest.json new release 1.1.3 2023-03-19 16:08:25 +08:00
package-lock.json new release 1.1.3 2023-03-19 16:08:25 +08:00
package.json new release 1.1.3 2023-03-19 16:08:25 +08:00
pseudocode.d.ts feat: add main function of render 2023-03-13 19:40:20 +08:00
README.md doc: add known issues 2023-03-19 14:04:58 +08:00
styles.css chore: inline online fonts with base64 2023-03-16 01:10:59 +08:00
tsconfig.json Initial commit 2023-03-13 15:05:19 +08:00
version-bump.mjs Initial commit 2023-03-13 15:05:19 +08:00
versions.json new release 1.1.3 2023-03-19 16:08:25 +08:00

Obsidian-Pseudocode

This is a plugin for Obsidian that allows you to render LaTeX-style pseudocode inside a code block. The plugin is based on pseudocode.js, a JavaScript library that typesets pseudocode beautifully to HTML.

Features

  • Intuitive grammar: The plugin takes a LaTeX-style input that supports the algorithmic constructs from LaTeX's algorithm packages. With or without LaTeX experience, a user should find the grammar fairly intuitive.
  • Print quality: The HTML output produced by the plugin is (almost) identical with the pretty algorithms printed on publications that are typeset by LaTeX.
  • Math formula support: Inserting math formulas in the pseudocode is as easy as LaTeX. Just enclose math expression in $...$ or \(...\).

Future Features

  • Syntax highlighting.
  • Auto-completion inside pseudo code block. (Release 1.1.0)

Usage

To use the plugin, simply create a code block in your Obsidian note and add your pseudocode inside it. Then, add the language specifier pseudo (short for "pseudocode") to the code block. The plugin will automatically render the pseudocode as LaTeX.

Here is an example:

    ```pseudo
    \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}
    ```

This will be rendered as:

example

Installation

To install the plugin, download the latest release from the releases page and extract it to your Obsidian plugins folder. Then, enable the plugin in your Obsidian settings.

Or just download it within Obsidian's community plugins. (Pending...)

Known Issues

  • The caption index will increase with each rendering.

Credits

This plugin is based on pseudocode.js, a JavaScript library that typesets pseudocode beautifully to HTML. Many thanks to the pseudocode.js team for their great work!