Links with nested HTML or \n confuse the markdown converter
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript
- 領域
- tooling
調査の方向性
この issue ではファイルもテストも指定されていません。まず、レポートにある3つの HTML リンクのケースを Markdown コンバーターで再現し、次に、そこで説明されているアンカーテキストのマッチングと node textContent の処理を調べてください。リンク内のネストされた要素と改行によって期待される Markdown リンクが生成され、報告された例に対するリグレッションカバレッジがある状態を完了とします。
索引モデルが issue の本文から書いたものです。
説明
A couple cases that generate the wrong markup.
1. nested html elements in link
<a href="http://example.com/"><span>foo</span></a> <a href="http://example.com/">bar</a> foo bar
gets converted to
[foo](http://example.com/) bar foo [bar](http://example.com/)
when I would expect
[foo](http://example.com/) [bar](http://example.com/) foo bar
What happens: the walker enters the a and then enters the span again, finding the same text twice. But the proper label text was already consumed, so it consumes until it finds another match. In some cases (like above) it even linkifies the wrong text.
2. line breaks in link
<a href="https://example.com/">foo
bar</a>
(notice the line break) gets converted to
foo bar
when I would expect
[foo bar](https://example.com/)
What happens: the node textContent is 'foo\nbar' which doesn't match any text in the plaintext.
2b. <br> in link
Another similar (but possibly harder to fix) case is
<a href="https://example.com/">foo<br>bar</a>
which like 2 doesn't create a link:
foo
bar
In general, since the code can't rely on the browser to properly deal with HTML content, some of these corner cases will probably keep popping up. But this happened in the real world (try copying and pasting the first news entry in the deprecated section here) and it seemed to be significant enough to report.
I will follow up with a PR that suggests potential fixes for 1 and 2 (but not 2b), but this is not my field so it might be far from good.
- 主要言語
- JavaScript
- スター
- 234
- フォーク
- 47
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 5
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/paste-markdown のほかの issue
-
Pasting a link whose text/html label is a shortened form of its URL plants a `[` inside the URL オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
github/paste-markdown#118 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
github/paste-markdown#107 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
github/paste-markdown#104 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
github/paste-markdown#100 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
github/paste-markdown#96 · コメント 1 件 ·
github/paste-markdown の issue をすべて見る
似ている issue
-
bug customer-eng Durable Agents Inngest status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
optimization optimization:agents-md-curator
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
githubnext/gh-aw-cao#13475 ·
-
[BUG]: "Clear All" in Settings doesn't clear the saved analysis, old data comes back after reload オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
AOSSIE-Org/OrgExplorer#253 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
oxc-project/oxc#26944 ·
-
ai-observability bug team/ai-observability
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100