Strip Hugo shortcodes so surrounding prose stays intact. Code-bearing paired shortcodes (mermaid/highlight/…) are removed body and all; every other shortcode tag is replaced with a space.
(text)
| 64 | |
| 65 | |
| 66 | def strip_shortcodes(text): |
| 67 | """Strip Hugo shortcodes so surrounding prose stays intact. |
| 68 | |
| 69 | Code-bearing paired shortcodes (mermaid/highlight/…) are removed body and |
| 70 | all; every other shortcode tag is replaced with a space. |
| 71 | """ |
| 72 | text = _PAIRED_CODE_RE.sub("\n\n", text) |
| 73 | return _SHORTCODE_RE.sub(" ", text) |
| 74 | |
| 75 | |
| 76 | def read_post(path): |
no test coverage detected