markdown_to_htmlをsubtree merge#101
Merged
Merged
Conversation
コードブロックの後の改行が消失してしまうのを修正
不要なインポートを削除 クラス定義の改行が多すぎたので、空行は1行だけにした
fenced code block 全体がインデントされていた場合に、インデントを削除するようにした。 タブのインデント量は、4としている。 なお、fenced code block 全体がインデントされているかどうかの判断は、 閉じマーク(終わりの```)がインデントされているかどうかで判断している。 また、削除するインデント量も閉じマークのインデント量としている。 したがって、閉じマークがインデントされていなければ、従来の挙動と変わらない。
fenced code block のインデントに対応
コード修飾にインデントが付いていても正常に機能するように修正
適格要件やテンプレートパラメータ制約などのため
内部リンクを相対リンクで生成する機能 (cpprefjp#81)
これまでは self._markdown.serializer が使われていたが、serializer は何 故か実体参照のパターンに一致する & を & に変換せずにそのまま出力す る仕様になっている [1]。これを用いてHTMLに戻すと例えば元々のHTMLソース で &var; となっていたものが処理後のHTMLソースで不正な実体参照 &var; になってしまい、ブラウザで正しく表示されなくなる可能性がある。例 えば reference/memory/addressof.html でこれが起こっている [2]。さらに、 後段でHTMLを解釈して処理しようとしたときにクラッシュする。 xml.etree.ElementTree が etree.tostring(method="xml") で正当なHTMLへの 変換に対応しているが、これを用いると <td></td> などが <td /> になって しまう。代わりに method="html" を使うと <br /> などが <br> になってし まう。また、どちらの method の場合でも HTML 属性の順序が変わってしまう ので好ましくない。 この実装では代わりに markdown.searializers の内部変数 markdown.searializers.RE_AMP を書き換えることによって期待する動作を得 ている。上流の markdown.searializers で実装の変更があると動かなくなる 可能性があることに注意する。 [1] https://github.com/Python-Markdown/markdown/blob/a11431539d08e14b0bd821ceb101fa59d6a74c8a/markdown/serializers.py#L69-L70 [2] https://github.com/cpprefjp/cpprefjp.github.io/blob/335489b522dcbb648c19a49e39cc880e187911a5/reference/memory/addressof.html#L263
…alize html_attribute: HTMLエンティティーが破壊される問題を修正
Ref. [1] で発見された問題。コードブロック後に改行を挟まずに文章を続け るとその文章がコード修飾指定のセクションとして抽出されて消失する問題。 対処法として改行を挿入する [2, 3] ことで回避できるが、改行がなくても正 しく表示されるようにしたい。ここでは、コード修飾の指定についてより厳密 な形式で抽出を行い、誤って関係ない物を抽出することを防ぐ [4]。 この変更のテストの過程で、既存のコード修飾の誤りが発見されたが対処した [5]。また、他にも消失している記述 [6] が発見されたが、[6] はこの変更に より自動的に修正されるので対処はしていない。 References: [1] cpprefjp/site#1362 (comment) [2] cpprefjp/site@c747f4a [3] cpprefjp/site@5259ff6 [4] cpprefjp/markdown_to_html#8 (comment) [5] cpprefjp/site@ebf8c8f [6] https://github.com/cpprefjp/site/blob/ebf8c8fd705a194adb7b3f83786dad9c843d143b/reference/generator/generator/iterator/op_increment.md?plain=1#L27
コードブロック後の修飾の抽出を厳密化
C++バージョンのバッジのtypo修正と「C++11を削除」の追加
Update for markdown 3.8
faithandbrave
approved these changes
Jun 5, 2026
Member
|
対応ありがとうございます〜 |
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.
closes #100