[ruby/rdoc] Enable cross reference in code

(https://github.com/ruby/rdoc/pull/1240)

Some people like to mark up method names in MarkDown style block
quotes, like this: ruby/ruby#12333.
Currently, no links are created in the code in the RDoc, but such
words most likely refer to methods.
This PR makes a word a code cross-reference if the whole word can be
resolved as a reference.

7d7efb0709
This commit is contained in:
Nobuyoshi Nakada 2024-12-18 06:48:27 +09:00 committed by git
parent 375fec7c53
commit fef8ecc708
3 changed files with 70 additions and 12 deletions

View file

@ -16,6 +16,18 @@ class RDocMarkupToHtmlCrossrefTest < XrefTestCase
result = @to.convert 'C1'
assert_equal para("<a href=\"C1.html\"><code>C1</code></a>"), result
result = @to.convert '+C1+'
assert_equal para("<a href=\"C1.html\"><code>C1</code></a>"), result
result = @to.convert 'FOO'
assert_equal para("FOO"), result
result = @to.convert '+FOO+'
assert_equal para("<code>FOO</code>"), result
result = @to.convert '<tt># :stopdoc:</tt>:'
assert_equal para("<code># :stopdoc:</code>:"), result
end
def test_convert_CROSSREF_method