UNIORG 는 통합 생태계와 호환되는 정확한 조직 모드 파서입니다.
Org-Mode Notes에서 내 BrainDump를 게시하고 싶습니다. 내가 시도한 파서 중 어느 것도 충분한 정밀도를 제공하지 않았습니다.
UNIORG는 파서를 쓰는 속도 나 편리한 속도가 아닌 구문 분석 정확도를 위해 노력합니다.
Uniorg는 조직 구문 및 조직 요소 API를 따릅니다. 그것은 org-element.el에서 크게 끌어옵니다. 이는 Uniorg가 조직 파일과 같은 방식으로 조직 파일을 보는 것을 의미합니다. 이 코드는 Regexes로 가득 차 있지만 Org 모드가 파일을 파일하는 방식입니다.
그러나 Org-Mode와의 몇 가지 의도적 인 편차가있어 Uniorg를 더 즐겁거나 쉽게 작업 할 수 있습니다.
Uniorg는 대부분의 조직 구문을 성공적으로 구문 분석합니다. 그러나 아직 끝내지 않은 곳은 몇 곳입니다.
구문의 나머지 부분은 EMAC와 정확히 동일한 방식으로 작동해야합니다 (복잡한 목록 중첩, 링크, 서랍, 시계 항목, 라텍스 등). 위의 항목을 돕고 싶다면 Grep Parser.ts TODO: .
이 저장소에는 다음 패키지가 포함되어 있습니다.
uniorg - UNIORG 구문 트리의 TypeScript 정의uniorg-parseuniorg-stringify -Stringify Uniorg Syntax Tree to Org-Mode Stringuniorg-rehype -uniorg 구문 트리를 rehype 로 변환합니다uniorg-extract-keywords -org-mode 키워드를 Vfile에 저장하십시오uniorg-attach attachment: file: 링크uniorg-slug -GitHub 알고리즘을 사용하여 제목에 앵커를 추가하십시오orgast-util-to-string 노드의 일반 텍스트 내용을 얻는 유틸리티orgast-util-visit-ids -ID가있는 모든 조직 노드를 방문하는 유틸리티UNIORG는 통합 생태계와 호환되므로 기존의 많은 플러그인을 활용할 수 있습니다.
예를 들어, 조직 모드를 HTML로 변환하는 방법은 다음과 같습니다.
import { unified } from 'unified' ;
import parse from 'uniorg-parse' ;
import uniorg2rehype from 'uniorg-rehype' ;
import stringify from 'rehype-stringify' ;
const processor = unified ( ) . use ( parse ) . use ( uniorg2rehype ) . use ( stringify ) ;
processor
. process ( `* org-mode examplen your text goes here` )
. then ( ( file ) => console . log ( file . value ) ) ;Code Syntax 하이라이트 (Rehype-Highlight, @Mapbox/Rehype-Prism) 및 Latex-Formatting (Rehype-Katex, Rehype-Mathjax) 용 플러그인은 다음과 같습니다.
import { unified } from 'unified' ;
import parse from 'uniorg-parse' ;
import uniorg2rehype from 'uniorg-rehype' ;
import highlight from 'rehype-highlight' ;
import katex from 'rehype-katex' ;
import stringify from 'rehype-stringify' ;
const processor = unified ( )
. use ( parse )
. use ( uniorg2rehype )
. use ( highlight )
. use ( katex )
. use ( stringify ) ;
processor
. process (
`* org-mode example
When $a ne 0$, there are two solutions to (ax^2 + bx + c = 0) and they are
$$x = {-b pm sqrt{b^2-4ac} over 2a}.$$
#+begin_src js
console.log('uniorg is cool!');
#+end_src
`
)
. then ( ( file ) => console . log ( file . value ) ) ;GNU 일반 공개 라이센스 v3.0 이상