https://github.com/oelin/codem
A simple YAML-based code-in-markdown compiler.
https://github.com/oelin/codem
build-tool code-in-markdown compiler documentation python yaml
Last synced: about 2 months ago
JSON representation
A simple YAML-based code-in-markdown compiler.
- Host: GitHub
- URL: https://github.com/oelin/codem
- Owner: oelin
- License: mit
- Created: 2023-01-08T22:05:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-26T02:16:35.000Z (over 3 years ago)
- Last Synced: 2025-06-01T16:31:48.243Z (about 1 year ago)
- Topics: build-tool, code-in-markdown, compiler, documentation, python, yaml
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeM
## Introduction
CodeM is a simple code-in-markdown compiler written in Python, and configurable using YAML. Code-in-markdown is a documentation style where source code and documentation are written side-by-side in markdown (`.md`) files. This format closely resembles notebooks commonly used in scientific computing contexts. CodeM works by stripping all non-source-code sections from a markdown file, leaving only interpretable code. For instance, consider the following code-in-markdown file:
# The `add()` function
This function adds two numbers together.
```py
def add(x, y):
return x + y
```
Lorem ipsum...
After compilation, CodeM will produce the following source file:
```py
def add(x, y):
return x + y
```
## Configuration
CodeM uses YAML to specify transformation rules on source and target files. For instance, the following `codem.yaml` file instructs CodeM to convert all `md` files in `./app` to `js` files in `src`.
```yaml
# Codem Configuraton File
output: src
rules:
- name: JavaScript Rule
from: md
to: js
locations:
- ./app
```
A full specification of CodeM YAML directives will be added to this section shortly.