Some new hook to manipulate the HTML at the token level before the parser merges the output into one string
メンテナーはふだん 4 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 22/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- compilers
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 37.3k
- フォーク
- 3.9k
- 平均マージ
- 5日 6時間
- マージ済み PR(30日)
- 62
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
markedjs/marked のほかの issue
-
Inline raw HTML is escaped after an unclosed `_` / `*` / `~` (regression in 18.2.1)対応中かも @O1sumitkumar が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 4 日以内に返信
-
Lazy continuation line inside a quoted list item is parsed as a nested list対応中かも @amstedy が 1 日前に担当しました。 オープンL2 - annoying
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
markedjs/marked#4293 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
-
Deeply nested emphasis is quadratic and overflows the stack in the lexer対応中かも @Pastalikek65 が 5 日前に担当しました。 オープンcategory: inline elements L2 - annoying
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
markedjs/marked#4286 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
Quadratic time in the inline `text` rule: its email look-ahead rereads the rest of the paragraph対応中かも @yxshee が 10 日前に担当しました。 オープンL2 - annoying
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 4 日以内に返信
-
List item ends at a lazy line after a paragraph line indented 4+ columns対応中かも @hakarrr が 14 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 4 日以内に返信
markedjs/marked の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Make the "%" unit spacing the same in the web and in A10対応中かも @kragent66-glitch が今日担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
maiychrus25/OpenTea-DX-OS#226 · コメント 1 件 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
nextcloud-libraries/nextcloud-dialogs#2772 ·
メンテナーはふだん 1 日以内に返信
-
Editor: leave an uploaded or inserted image's alt text empty, so the preview asks for a descriptionオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 65/100
sveltejs/svelte.dev#2417 ·
メンテナーはふだん 1 日以内に返信