feat(npm): lezer 확장 — @lezer/markdown 이 mdwire 규칙으로 강조를 읽는다 - #103
Merged
Merged
Conversation
minjun0219
added this pull request to stack #101
October 2, 2026 14:54
minjun0219
marked this pull request as ready for review
October 2, 2026 22:44
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5cd9be352
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
minjun0219
force-pushed
the
feat/lezer-emphasis
branch
from
October 2, 2026 23:19
b5cd9be to
80fb666
Compare
mdwire 를 거치지 않고 `@lezer/markdown` · CodeMirror 로 마크다운을 그리는 화면에서 `**설정(config)**을` 의 별표가 그대로 보인다. 코어 `inline.rs` 의 읽기 규칙을 lezer 인라인 파서로 옮긴 확장을 `./lezer` 서브패스로 낸다 (mdwire-16 2단계). WASM 없음, `@lezer/markdown` 은 선택 peer. - lezer 의 기본 구분자 해석은 내장 구분자에만 크기·"3의 배수" 규칙을 적용해 못 쓴다. 확장용 API (`findOpeningDelimiter` · `takeContent`)로 닫는 자리에서 바로 짝을 맺는다 — 코어 규칙 1 과 같은 모양 - 옮긴 규칙: 닫기(앞이 공백 아님) · 열기(`can_open`, `①` 은 글자 아님) · 먼저 연 쪽이 짐 · `_` 단어 안 · `***` 쪼개기 · 막힌 여는 마커의 거울 짝(수식 제외) · `~~`(GFM 노드가 있을 때만) - 코어와 다른 것 셋(의도): 짝 잃은 마커는 글자로, 블록 끝에서 닫지 않음, `****` 이상은 글자 - 스모크가 설치한 패키지로 코어의 텔레그램 출력과 17가지를 대조한다. 실제 문단 6,965개 대조에서 규칙 차이는 위 셋뿐 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
코어에 넣은 규칙(#100 리뷰 반영)을 lezer 확장에도 같이 넣는다. 막힌 여는 마커가 열려 있을 때 앞이 여는 괄호·따옴표인 마커(`2**(n-1) (**주의**)` 의 둘째 `**`)는 거울이 아니라 새 강조의 여는 마커다. 이때 막힌 마커는 물려서(`retire`) 더는 짝 후보가 되지 않고 글자로 남는다 — 코어가 글자로 되돌리는 것과 같다. 막힌 마커가 또 올 때도 앞의 것을 같이 물린다. Co-Authored-By: Claude <noreply@anthropic.com>
minjun0219
force-pushed
the
feat/lezer-emphasis
branch
from
October 2, 2026 23:23
80fb666 to
294b266
Compare
PR #103 의 Codex 리뷰 두 건을 반영한다. - 규칙 2(앞이 공백인 여는 마커가 또 오면 먼저 열린 쪽이 진다)에서 진 구분자를 `cx.parts` 에 그대로 두어 `**old⏎**new** tail**` 의 끝 `**` 가 첫 `**` 와 다시 짝지어 문단 전체가 굵어졌다. 진 구분자를 물려서(`retire`) 더는 짝 후보가 되지 않고 글자로 남게 한다. - `@lezer/markdown` peer 범위를 `>=1.5` 로 올린다 — 확장이 쓰는 `getDelimiterAt` 은 1.5.0 에서 생겼다(1.4.3 에는 없다, 확인). 스모크는 peer 범위의 바닥 판으로 깔아 돌리고 최신판으로 한 번 더 돌린다 — 전에는 최신판만 깔아 바닥이 깨져도 몰랐다. Co-Authored-By: Claude <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mdwire 를 거치지 않고
@lezer/markdown· CodeMirror 로 마크다운을 그리는 화면에서는**설정(config)**을의 별표가 그대로 보인다. 코어inline.rs의 읽기 규칙을 lezer 인라인 파서로 옮긴 확장을 npm./lezer서브패스(koreanEmphasis)로 낸다 — mdwire-16 2단계. WASM 없음,@lezer/markdown은 선택 peer. #102 위에 쌓았다.변경 사항
닫는 자리에서 바로 짝을 맺는다
lezer 의 기본 구분자 해석(
resolveMarkers)은 내장 구분자 객체에만 굵게·기울임 크기와 "3의 배수" 규칙을 적용해서(참조 비교) 쓸 수 없다. 확장용 APIfindOpeningDelimiter·takeContent로 닫는 마커가 오는 자리에서 가장 가까운 같은 종류를 바로 닫는다 — 코어 규칙 1 과 같은 모양이고, 그래서 코어의 상태 기계를 거의 그대로 옮길 수 있었다. 막힌 여는 마커는 따로 둔 구분자 타입이라 보통 닫는 마커가 보지 못한다.crates/mdwire-wasm/js/lezer.js:116
코어와 일부러 다르게 둔 셋
짝 잃은 마커는 글자로 둔다(코어는 일부를 버린다 — 파서는 글자를 지우지 않는다). 블록 끝에서 닫아 주지 않는다(복구는 코어의 일).
****이상은 글자다(마스킹 번호). 실제 문단 6,965개로 코어의 텔레그램 출력과 대조해 규칙 차이는 이 셋뿐인 것을 확인했다.crates/mdwire-wasm/js/lezer.js:173
스모크가 코어와 대조한다
설치한 패키지로
@lezer/markdown을 깔고 17가지 입력을render(…, "telegram-html")과 같은지 본다. 설정을 쌓는 두 순서와 GFM 없는 경우도.scripts/smoke-lezer.mjs:1
검증
스모크(Node · Bun · 타입) · 사이트 빌드 · readme-sync 통과. CodeMirror 안에서 돌려 보지는 않았다 —
markdown({ base, extensions: [koreanEmphasis] })는 lezer 확장을 그대로 받는 API 라 같은 코드가 돈다고 보지만, 실제 화면은 쓰는 쪽(rocky)에서 처음 본다.모든 리뷰 코멘트는 한국어로 작성해 주세요.
🤖 Generated with Claude Code