myst

Table 1 sphinx extension

extension

description

sphinx-design

beautiful, responsive web components to your documentation

sphinx-copybutton

a copy button to your code blocks

sphinx-rediraffe

redirects to your documentation

sphinx-opengraph

OpenGraph metadata to your documentation

sphinx-pyscript

execute python code in your documentation

sphinx-tippy

tooltips to your documentation

sphinx-autodoc2

generate documentation from docstrings

sphinx-togglebutton

collapsible content to your documentation

sphinx-mermaid

generate Mermaid diagrams

1. install

import os

home_dir = os.path.expanduser('~')
work_dir = f'{home_dir}/tdc'

os.chdir(work_dir)
!pwd
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[1], line 6
      3 home_dir = os.path.expanduser('~')
      4 work_dir = f'{home_dir}/tdc'
----> 6 os.chdir(work_dir)
      7 get_ipython().system('pwd')

FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/tdc'
#!pdm add myst-parser
!pdm show myst-parser
Name:                  myst-parser                                              
Latest version:        2.0.0                                                    
Latest stable version: 2.0.0                                                    
Installed version:     0.18.1                                                   
Summary:               An extended [CommonMark](https://spec.commonmark.org/)   
                       compliant parser,                                        
Requires Python:       >=3.8                                                    
Author:                                                                         
Author email:          Chris Sewell <chrisj_sewell@hotmail.com>                 
License:                                                                        
Homepage:                                                                       
Project URLs:          Documentation: https://myst-parser.readthedocs.io        
                       Homepage: https://github.com/executablebooks/MyST-Parser 
Platform:                                                                       
Keywords:              markdown, lexer, parser, development, docutils, sphinx   

2. markdown syntax

2.1 example

markdown example

    ### header 3
    * unordered list
        * unordered list
    ```{admonition} This is custom title
    :class: dropdown
    this is a message
    ```
    badge {bdg-primary}`badge`

result

header 3

  • unordered list

    • unordered list

badge badge

2.2 guide

3. use MyST in sphinx

3.1 configure (conf.py in sphinx)

  • sphinx가 설치되어 있지 않으면 sphinx 설치

  • sphinx 설정 파일 conf.py에 myst extension 추가

conf.py 파일 수정

extensions = ['myst_parser']