Skip to content

About

Compact markdown table padding back to single-space style. PowerShell + Bash.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

md-table-compact

마크다운 표의 컬럼 정렬 padding을 제거하고 compact 스타일로 정리하는 PowerShell 스크립트.

대부분의 마크다운 포매터(Prettier, Markdown All in One 등)는 표 컬럼을 공백으로 정렬한다. 렌더링 결과는 같지만, raw 텍스트에서 보면 의미 없는 공백이 잔뜩 들어가 거슬릴 때가 있다. 이 스크립트는 그 공백을 한 칸으로 압축한다.

Before / After

Before (Prettier 등이 만든 정렬 스타일)

| 영역          | 사용 기술                                                                               |
| ------------- | --------------------------------------------------------------------------------------- |
| Compute       | EKS (1.35), Managed Node Group (m5.large × 2~4)                                         |
| Data          | RDS MariaDB 10.11, ElastiCache Valkey 8, OpenSearch 2.19, S3, EFS                       |
| Observability | CloudWatch (알람·대시보드), SNS, Amazon Q Developer in chat applications (Slack 라우팅) |

After (compact)

| 영역 | 사용 기술 |
| --- | --- |
| Compute | EKS (1.35), Managed Node Group (m5.large × 2~4) |
| Data | RDS MariaDB 10.11, ElastiCache Valkey 8, OpenSearch 2.19, S3, EFS |
| Observability | CloudWatch (알람·대시보드), SNS, Amazon Q Developer in chat applications (Slack 라우팅) |

사용법

대상 디렉터리를 인자로 받는다 (생략 시 현재 디렉터리). 지정 경로 기준으로 하위 모든 .md 파일을 재귀 탐색해 정리하며, 변경된 파일만 다시 쓰므로 mtime이 불필요하게 갱신되지 않는다.

Windows (PowerShell)

pwsh ./md-table-compact.ps1            # 현재 디렉터리
pwsh ./md-table-compact.ps1 ./docs     # 특정 디렉터리

PowerShell 5.x도 지원한다.

powershell -File ./md-table-compact.ps1 ./docs

macOS / Linux (bash)

chmod +x ./md-table-compact.sh         # 최초 1회
./md-table-compact.sh                  # 현재 디렉터리
./md-table-compact.sh ./docs           # 특정 디렉터리

bash + awk + find만 있으면 동작한다 (대부분의 Unix 환경 기본).

동작 규칙

  • 표 행(|로 시작하고 끝나는 줄)만 처리
    • 헤더/데이터 행 → | 셀 | 셀 | (양옆 공백 1칸)
    • 구분선 행 → | --- | --- | (대시 3개로 정규화, 헤더와 파이프 정렬)
  • 정렬 마커 보존: :---, ---:, :---:
  • 원본 줄바꿈(CRLF/LF) 자동 감지·유지
  • UTF-8 (BOM 없음)으로 저장
  • 코드블록(triple-backtick(```) 또는 triple-tilde(~~~)) 안의 표는 건드리지 않음

알려진 한계

  • 외곽 |가 없는 표(a | b | c 스타일)는 무시한다. 안전을 위함.
  • 정렬을 시각적으로 유지하고 싶은 경우엔 이 스크립트가 맞지 않는다. Prettier나 Markdown All in One의 기본 동작을 그대로 쓰면 된다.

License

MIT

About

Compact markdown table padding back to single-space style. PowerShell + Bash.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages