Some new hook to manipulate the HTML at the token level before the parser merges the output into one string
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 22/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- compilers
Hướng nghiên cứu
Read the parser in src/Parser.ts to see where each token's rendered HTML is produced and joined, then the renderer and the walkTokens hook in src/Instance.ts and src/Renderer.ts to understand what is reachable today. Check test/ for parser and extension tests, and the extension docs for existing hooks. Done here means an agreed hook design, not a patch: a place where a token and its partial HTML are still both in scope.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What pain point are you perceiving?.
I would like to create an extension that injects HTML properties into the HTML tag of every block-level token. I.e.:
<p customInjectedProperty="someValueFromTheToken">content</p>
Specifically, in this instance I would like to inject the line number from marked-token-position to support Markdown/HTML position syncing.
However the parser does not provide a good opportunity to do so before everything is joined into the final output string. Overriding the renderer for every token can solve this, but can't support tokens from third-party extensions without maintaining a custom list.
I can kind of get away with using walkTokens to just replace the original token.type with some custom token.type = "injectHTMLProp", so it can be caught univerally by the renderer of a custom extension named "injectHTMLProp", where I parse each token and inject properties into the output string while I have access to the token properties, though this feels ugly and makes it hard for other extensions that may also want to similarly manipulate the local HTML before the final string merge.
Describe the solution you'd like
Ideally, it would be nice if the parser somehow maintained a map of token: outputHTML before the final string merge, where a hook could still slip in and manipulate the HTML while we still have access to the accompanying token properties.
- Ngôn ngữ chính
- TypeScript
- Star
- 37.3k
- Fork
- 3.9k
- Merge trung bình
- 5 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 62
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của markedjs/marked
-
Inline raw HTML is escaped after an unclosed `_` / `*` / `~` (regression in 18.2.1)Có thể đã có người làm @O1sumitkumar đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Lazy continuation line inside a quoted list item is parsed as a nested listCó thể đã có người làm @amstedy đã nhận 1 ngày trước. Đang mởL2 - annoying
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
markedjs/marked#4293 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Deeply nested emphasis is quadratic and overflows the stack in the lexerCó thể đã có người làm @Pastalikek65 đã nhận 5 ngày trước. Đang mởcategory: inline elements L2 - annoying
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
markedjs/marked#4286 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Quadratic time in the inline `text` rule: its email look-ahead rereads the rest of the paragraphCó thể đã có người làm @yxshee đã nhận 10 ngày trước. Đang mởL2 - annoying
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 4 ngày
-
List item ends at a lazy line after a paragraph line indented 4+ columnsCó thể đã có người làm @hakarrr đã nhận 15 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của markedjs/marked
Issue tương tự
-
Media browser returns "Not found" for repositories using the SHA-256 object formatCó thể đã có người làm @adamchodera đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Follow-ups from #312Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
janhesters/remixcn#318 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Interceptor LaunchTestProfile.sh: no Windows (Git Bash/MSYS) branch, test profile never launchesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
danielmiessler/LifeOS#3150 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Make the "%" unit spacing the same in the web and in A10Có thể đã có người làm @kragent66-glitch đã nhận hôm nay. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
maiychrus25/OpenTea-DX-OS#226 · 1 bình luận ·