Uniorg เป็นตัวแยกวิเคราะห์โหมด ORG ที่ถูกต้องเข้ากันได้กับระบบนิเวศแบบครบวงจร
ฉันต้องการเผยแพร่ BrainDump จาก Notes Org-Mode ไม่มีตัวแยกวิเคราะห์ที่ฉันพยายามให้ความแม่นยำเพียงพอ
Uniorg มุ่งมั่นที่จะแยกวิเคราะห์ความแม่นยำมากกว่าความเร็วหรือความสะดวกในการเขียนตัวแยกวิเคราะห์
Uniorg ติดตาม ORG SYNTAX และ ORG Element API มันดึงออกมาอย่างหนักจาก org-etement.el ซึ่งหมายความว่า Uniorg เห็นไฟล์ org ในลักษณะเดียวกับโหมด org รหัสนี้เต็มไปด้วย regexes แต่นั่นเป็นวิธีการแยกไฟล์ของโหมด ORG
แม้ว่าจะมีการเบี่ยงเบนโดยเจตนาสองสามโหมดที่ทำให้ Uniorg น่าพอใจหรือง่ายขึ้นในการทำงาน
UNIORG ประสบความสำเร็จในการแยกวิเคราะห์ไวยากรณ์ส่วนใหญ่ขององค์กร อย่างไรก็ตามมีสถานที่สองสามแห่งที่ฉันยังไม่เสร็จ:
ส่วนที่เหลือของไวยากรณ์ควรทำงานได้ดีและในลักษณะเดียวกับใน EMACS (รวมถึงการทำรังรายการที่ซับซ้อนลิงก์ลิ้นชักรายการนาฬิกาน้ำยาง ฯลฯ ) หากคุณต้องการช่วยเหลือรายการด้านบน Grep parser.ts สำหรับ TODO:
ที่เก็บนี้มีแพ็คเกจต่อไปนี้:
uniorg - คำจำกัดความ typeScript ของแผนผังไวยากรณ์ Uniorguniorg-parse แยกไฟล์โหมด org parse ไปยังต้นไวยากรณ์ Uniorguniorg-stringify -Stringify uniorg ไวยากรณ์แผนผังไปยังสตริงโหมด orguniorg-rehype แปลงต้นไวยากรณ์ของ Uniorg เป็น rehypeuniorg-extract-keywords คำหลัก org-mode ไปยัง vfileuniorg-attach แปลง attachment: ลิงก์ไปยัง file: ลิงก์uniorg-slug เพิ่มจุดยึดลงในส่วนหัวโดยใช้อัลกอริทึมของ GitHuborgast-util-to-string ยูทิลิตี้เพื่อรับเนื้อหาข้อความธรรมดาของโหนดorgast-util-visit-ids ยูทิลิตี้เพื่อเยี่ยมชมโหนด org ทั้งหมดด้วย IDSUniorg เข้ากันได้กับระบบนิเวศแบบครบวงจรดังนั้นคุณสามารถใช้ประโยชน์จากปลั๊กอินที่มีอยู่จำนวนมาก
ตัวอย่างเช่นนี่คือวิธีที่คุณเปลี่ยนโหมดองค์กรเป็น 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 ) ) ;ปลั๊กอินสำหรับไฮไลต์ไวยากรณ์รหัส (rehype-highlight, @mapbox/rehype-prism) และรูปแบบ latex (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 หรือใหม่กว่า