mkdocs-pseudocode


Namemkdocs-pseudocode JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://github.com/JulesTopart/mkdocs-pseudocode
SummaryA MkDocs plugin to render beautiful pseudocode with LaTeX-inspired syntax.
upload_time2024-10-01 12:28:15
maintainerNone
docs_urlNone
authorJules Topart
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MkDocs Pseudocode Plugin

This MkDocs plugin allows you to write beautiful pseudocode in your MkDocs documentation using a simplified syntax inspired by LaTeX.

![](image.jpg)

## Features

- Render pseudocode blocks with LaTeX-inspired syntax
- Support for common control structures (`if`, `for`, `while`, `repeat`, `foreach`)
- Math expressions rendered using MathJax
- Nested procedures and calls
- Automatic indentation and keyword highlighting

## Installation

1. Install the plugin locally:

   ```bash
   pip install mkdocs-pseudocode
   ```

2. Add the plugin to your `mkdocs.yml` configuration file:

   ```yaml
   plugins:
     - search
     - pseudocode
   ```

3. Copy CSS file into your `extra.css` file of your Mkdocs project

    Place the `pseudo-code.css` file in the `docs/css/` directory of your MkDocs project.

    Add the following lines to your `mkdocs.yml` file:

    ```yaml
    extra_css:
        - css/pseudo-code.css
    ```

## Usage

Write your pseudocode in fenced code blocks with the `pseudocode` language identifier:

```markdown
```pseudocode
% This quicksort algorithm is extracted from Chapter 7, Introduction to Algorithms (3rd edition)
\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
    \ENDFOR
    \STATE exchange $A[i]$ with $A[r]$
\ENDPROCEDURE
\end{algorithmic}
\end{algorithm}
```

## Customization

### CSS

You can customize the appearance of the pseudocode by adding your own CSS rules. The default CSS classes used are:

- `.ps-root`
- `.ps-algorithm`
- `.ps-algorithmic`
- `.ps-caption`
- `.ps-keyword`
- `.ps-procedure`
- `.ps-if`
- `.ps-for`
- `.ps-while`
- `.ps-repeat`
- `.ps-foreach`
- `.ps-state`
- `.ps-call`
- `.ps-funcname`
- `.ps-indent-{level}`

### JavaScript

To ensure MathJax expressions are rendered correctly, you may need to add the following JavaScript snippet to your MkDocs theme:

```html
<script>
document.addEventListener("DOMContentLoaded", function() {
    if (typeof MathJax !== 'undefined') {
        MathJax.typesetPromise();
    }
});
</script>
```

## License

This project is licensed under the MIT License.

## Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss your ideas.

## Author

Jules TOPART

---

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/JulesTopart/mkdocs-pseudocode",
    "name": "mkdocs-pseudocode",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Jules Topart",
    "author_email": "jules.topart@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fb/1f/7f17f3322eccf374e0e24ce057abdc328b9935fad6fbbf026db58d48c94e/mkdocs_pseudocode-0.1.4.tar.gz",
    "platform": null,
    "description": "# MkDocs Pseudocode Plugin\r\n\r\nThis MkDocs plugin allows you to write beautiful pseudocode in your MkDocs documentation using a simplified syntax inspired by LaTeX.\r\n\r\n![](image.jpg)\r\n\r\n## Features\r\n\r\n- Render pseudocode blocks with LaTeX-inspired syntax\r\n- Support for common control structures (`if`, `for`, `while`, `repeat`, `foreach`)\r\n- Math expressions rendered using MathJax\r\n- Nested procedures and calls\r\n- Automatic indentation and keyword highlighting\r\n\r\n## Installation\r\n\r\n1. Install the plugin locally:\r\n\r\n   ```bash\r\n   pip install mkdocs-pseudocode\r\n   ```\r\n\r\n2. Add the plugin to your `mkdocs.yml` configuration file:\r\n\r\n   ```yaml\r\n   plugins:\r\n     - search\r\n     - pseudocode\r\n   ```\r\n\r\n3. Copy CSS file into your `extra.css` file of your Mkdocs project\r\n\r\n    Place the `pseudo-code.css` file in the `docs/css/` directory of your MkDocs project.\r\n\r\n    Add the following lines to your `mkdocs.yml` file:\r\n\r\n    ```yaml\r\n    extra_css:\r\n        - css/pseudo-code.css\r\n    ```\r\n\r\n## Usage\r\n\r\nWrite your pseudocode in fenced code blocks with the `pseudocode` language identifier:\r\n\r\n```markdown\r\n```pseudocode\r\n% This quicksort algorithm is extracted from Chapter 7, Introduction to Algorithms (3rd edition)\r\n\\begin{algorithm}\r\n\\caption{Quicksort}\r\n\\begin{algorithmic}\r\n\\PROCEDURE{Quicksort}{$A, p, r$}\r\n    \\IF{$p < r$} \r\n        \\STATE $q = $ \\CALL{Partition}{$A, p, r$}\r\n        \\STATE \\CALL{Quicksort}{$A, p, q - 1$}\r\n        \\STATE \\CALL{Quicksort}{$A, q + 1, r$}\r\n    \\ENDIF\r\n\\ENDPROCEDURE\r\n\\PROCEDURE{Partition}{$A, p, r$}\r\n    \\STATE $x = A[r]$\r\n    \\STATE $i = p - 1$\r\n    \\FOR{$j = p$ \\TO $r - 1$}\r\n        \\IF{$A[j] < x$}\r\n            \\STATE $i = i + 1$\r\n            \\STATE exchange $A[i]$ with $A[j]$\r\n        \\ENDIF\r\n    \\ENDFOR\r\n    \\STATE exchange $A[i]$ with $A[r]$\r\n\\ENDPROCEDURE\r\n\\end{algorithmic}\r\n\\end{algorithm}\r\n```\r\n\r\n## Customization\r\n\r\n### CSS\r\n\r\nYou can customize the appearance of the pseudocode by adding your own CSS rules. The default CSS classes used are:\r\n\r\n- `.ps-root`\r\n- `.ps-algorithm`\r\n- `.ps-algorithmic`\r\n- `.ps-caption`\r\n- `.ps-keyword`\r\n- `.ps-procedure`\r\n- `.ps-if`\r\n- `.ps-for`\r\n- `.ps-while`\r\n- `.ps-repeat`\r\n- `.ps-foreach`\r\n- `.ps-state`\r\n- `.ps-call`\r\n- `.ps-funcname`\r\n- `.ps-indent-{level}`\r\n\r\n### JavaScript\r\n\r\nTo ensure MathJax expressions are rendered correctly, you may need to add the following JavaScript snippet to your MkDocs theme:\r\n\r\n```html\r\n<script>\r\ndocument.addEventListener(\"DOMContentLoaded\", function() {\r\n    if (typeof MathJax !== 'undefined') {\r\n        MathJax.typesetPromise();\r\n    }\r\n});\r\n</script>\r\n```\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License.\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please submit a pull request or open an issue to discuss your ideas.\r\n\r\n## Author\r\n\r\nJules TOPART\r\n\r\n---\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A MkDocs plugin to render beautiful pseudocode with LaTeX-inspired syntax.",
    "version": "0.1.4",
    "project_urls": {
        "Homepage": "https://github.com/JulesTopart/mkdocs-pseudocode"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c28c5dda5359bac712c01113e664deffd382fd3e95f209b6914580900b5ddc9e",
                "md5": "bfde5ef151a31b1b99299fc199770057",
                "sha256": "1fe168cc91ccf0ddf037249ea49c986a14f82a8efa292a79650f0c3f457d7393"
            },
            "downloads": -1,
            "filename": "mkdocs_pseudocode-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bfde5ef151a31b1b99299fc199770057",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5246,
            "upload_time": "2024-10-01T12:28:14",
            "upload_time_iso_8601": "2024-10-01T12:28:14.394261Z",
            "url": "https://files.pythonhosted.org/packages/c2/8c/5dda5359bac712c01113e664deffd382fd3e95f209b6914580900b5ddc9e/mkdocs_pseudocode-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb1f7f17f3322eccf374e0e24ce057abdc328b9935fad6fbbf026db58d48c94e",
                "md5": "5e05591c234d95fbc3f7c669a2189ba7",
                "sha256": "b6ed30fa8b0057946267e6f85f59fc8dac6fb4fb7178f8e806ca43f96fa70aa2"
            },
            "downloads": -1,
            "filename": "mkdocs_pseudocode-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "5e05591c234d95fbc3f7c669a2189ba7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4871,
            "upload_time": "2024-10-01T12:28:15",
            "upload_time_iso_8601": "2024-10-01T12:28:15.753837Z",
            "url": "https://files.pythonhosted.org/packages/fb/1f/7f17f3322eccf374e0e24ce057abdc328b9935fad6fbbf026db58d48c94e/mkdocs_pseudocode-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-01 12:28:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JulesTopart",
    "github_project": "mkdocs-pseudocode",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mkdocs-pseudocode"
}
        
Elapsed time: 0.52991s