마크다운 컴파일러(?)
개요
- 뭔가 글을 쓰기 위함.
- (\TeX)은 컴파일하는데 시간이 오래 걸리기 때문에, 편하게 문서를 쓸 수 있는 마크다운에 관심이 셩겼음
- 근데, 사이트마다 문법이 다름. 내가 쓴 마크다운 글이 어떤 일정한 알고리즘으로 HTML로 변환되었으면 했음
- 2일동안 글을 썼고, 이 글을 바꾸기 위해서 2일 정도 틈틈히 코딩을 해서 만듦 (총 3일)
구현
- 천천히 위에서부터 한 줄 한 줄 읽어나감. 이게 표인지, 제목을 위한 줄(
===
)인지 구분하고, 그 다음 세세한 것들로 넘김
- 들여쓰기를 통해 테그를 중복해 넣을 수 있기 때문에, 대충 재귀함수 느낌으로 구현함.
- 출력은,
mdps.js
가 저장된 폴더에다가 tmp.html
이라는 이름으로 저장됨.
제공 기능
- 기본적인 마크다운 문법 (
#
, -
, >
, \\t
등)
- 표만들기
- 주석달기
- 목차만들기
- 복사 방지 (css
:after
선택자 이용)
의존성
실행
node mdps [파일경로]
예시 보기
이 문서(README.md)를 본 컴파일러(?)로 변환환 예시
- 최소한의 디자인만 해서 좀 보기가 좋지 않다. css가 필요함