隣り合った code を結合するようにした#7
Merged
Merged
Conversation
文中の code の一部をリンクにしたい場合、コードを分割する必要があり ますが、そうすると html では code 要素が分割されてしまい妙に間が 空いて間が抜けて見えてしまいます。 そこで、隣り合った code 要素を結合するようにしてみました。 ただし、markdown の書き方の問題でそれだけではうまくいかないので、 まず最初に、 <a href="..."><code>...</code></a> を <code><a href="...">...</a></code> に変換してから結合するようにしています。 また、code 要素の間は空白 1 文字まで許容しています。 ちゃんと html を解釈した方が良いとは思うのですが、ちょっと横着 をして、単なる正規表現で処理しちゃってます。 現時点で cpprefjp では変換エラーは発生しませんでした。 全ページ目視確認したわけでは無いのですが、何ページかサンプルで 見た感じではうまく変換できているようでした。 いかがでしょうか?
Member
Author
|
あ、書き忘れました。
も
に変換しています。 |
Member
|
確認用に、問題が起きてるページを1つ教えて下さい |
Member
Author
Member
take-cheeze
pushed a commit
that referenced
this pull request
Jun 5, 2026
html_attribute: HTMLエンティティーが破壊される問題を修正
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.


文中の
codeの一部をリンクにしたい場合、コードを分割する必要がありますが、そうすると html ではcode要素が分割されてしまい妙に間が空いて間が抜けて見えてしまいます。そこで、隣り合った
code要素を結合するようにしてみました。ただし、markdown の書き方の問題でそれだけではうまくいかないので、まず最初に、
<a href="..."><code>...</code></a>を
<code><a href="...">...</a></code>に変換してから結合するようにしています。
また、
code要素の間は空白 1 文字まで許容しています。ちゃんと html を解釈した方が良いとは思うのですが、ちょっと横着をして、単なる正規表現で処理しちゃってます。
現時点で cpprefjp では変換エラーは発生しませんでした。
全ページ目視確認したわけでは無いのですが、何ページかサンプルで見た感じではうまく変換できているようでした。
いかがでしょうか?