{"id":13557602,"url":"https://github.com/vatlab/markdown-kernel","last_synced_at":"2025-10-21T20:20:20.411Z","repository":{"id":57439691,"uuid":"126882424","full_name":"vatlab/markdown-kernel","owner":"vatlab","description":"A markdown kernel for Jupyter","archived":false,"fork":false,"pushed_at":"2020-08-24T06:01:44.000Z","size":26,"stargazers_count":23,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-23T10:54:36.889Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vatlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-26T19:54:22.000Z","updated_at":"2023-12-04T20:01:39.000Z","dependencies_parsed_at":"2022-09-19T20:44:28.987Z","dependency_job_id":null,"html_url":"https://github.com/vatlab/markdown-kernel","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatlab%2Fmarkdown-kernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatlab%2Fmarkdown-kernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatlab%2Fmarkdown-kernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatlab%2Fmarkdown-kernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vatlab","download_url":"https://codeload.github.com/vatlab/markdown-kernel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247002120,"owners_count":20867401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T12:04:26.647Z","updated_at":"2025-10-21T20:20:15.370Z","avatar_url":"https://github.com/vatlab.png","language":"Python","readme":"[![Anaconda-Server Badge](https://anaconda.org/conda-forge/markdown-kernel/badges/version.svg)](https://anaconda.org/conda-forge/markdown-kernel)\n[![PyPI version](https://badge.fury.io/py/markdown-kernel.svg)](https://badge.fury.io/py/markdown-kernel)\n\n# A markdown kernel for Jupyter\n\n## Installation\n\nIf you are using a conda environment, you can install `markdown-kernel` with command\n\n```\nconda install -c conda-forge markdown-kernel\n```\n\nOtherwise, with a working [Jupyter](http://jupyter.org/) installation, you can install `markdown-kernel` with commands\n\n```\npip install markdown-kernel\npython -m markdown_kernel.install\n```\n\nYou can verify if a `markdown` kernel is properly installed with command\n\n```\njupyter kernelspec list\n```\n\n## Use a `markdown` kernel by itself\n\n`markdown-kernel` is a simple Jupyter kernel that displays\ncell content as markdown. To use this kernel, you can start a Jupyter \nserver with command `jupyter notebook` or `jupyter lab`, create a notebook\nwith this kernel, enter and render markdown texts.\n\n![image](https://user-images.githubusercontent.com/9889312/68800753-4d128180-0620-11ea-8d99-5b755963d537.png)\n\nBut wait, this is *stupid* because you can do the same thing in\nJupyter, only easier. What is the point of a markdown kernel by itself?\n\n## Use a Markdown kernel in SoS Notebook\n\nIf you are familiar with [`R Markdown`](https://github.com/rstudio/rmarkdown), you might know and like its [inline code](https://rmarkdown.rstudio.com/lesson-4.html) that allows results to be inserted directly into the text of a .Rmd file by enclosing the code with `` `r ` ``. This is really convenient for\nwriting Rmarkdown report but cannot be done in Jupyter because Jupyter's markdown cells are rendered at the frontend and do not interact with Jupyter kernels  (See [ipython/ipython#2592](https://github.com/ipython/ipython/issues/2592), [jupyter/help#41](https://github.com/jupyter/help/issues/41),and [jupyter/notebook#3463](https://github.com/jupyter/notebook/issues/3463) for related discussions).\n\n[SoS Notebook](https://vatlab.github.io/sos-docs/) is a Jupyter kernel that supports the\nuse of multiple kernels in one Jupyter notebook. Although a markdown kernel by itself cannot\ninterpolate and evaluate expressions either, you can the `%expand` magic of SoS to enable\ninline expressions in Jupyter, for Python, R, and potentially many other languages. Here\nis how it works:\n\n### Expand expressions with SoS (Python) variables\n\nThe SoS kernel is a super kernel that starts and communicates with all other Jupyter\nkernels. Its syntax is a super set of Python 3.6+ so you can execute any Python code\nin SoS kernels. The `%expand` magic treats the content of a markdown cell as a Python\nf-string and expands expressions enclosed in `{ }`, or other delimiters as option of\nmagic `%expand`.\n\n![image](https://user-images.githubusercontent.com/9889312/68431746-878ba280-0178-11ea-8c47-79f5db775299.png)\n\n**NOTE**: Starting from [`jupyterlab-sos`](https://github.com/vatlab/jupyterlab-sos) version 0.6.3, \nthe input of codecell with Markdown kernel are folded automatically after cell execution.\n\n### Expand expressions in subkernels such as R\n\nThe `--in` option of magic `%expand` allows you to expand the cell content in\nspecified subkernel, if its language module supports the `expand` protocol. This\nallows the content in `markdown` cells to be expanded in other languages such as R.\nMost notably, you can use\n\n```\n%expand `r ` --in R\n```\nto expand inline expressions in `R Markdown` texts.\n\n![image](https://user-images.githubusercontent.com/9889312/68431685-6fb41e80-0178-11ea-8ccb-56135d6a1c37.png)\n\nThis technique is used by [sos-rmarkdown](https://github.com/vatlab/sos-rmarkdown), a RMarkdown to SoS Notebook converter to convert markdown text with inline expressions.\n","funding_links":[],"categories":["Python","others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvatlab%2Fmarkdown-kernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvatlab%2Fmarkdown-kernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvatlab%2Fmarkdown-kernel/lists"}