Skip to content

Commit 79da81e

Browse files
Allow links in doc blocks headings
1 parent 9b97045 commit 79da81e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/librustdoc/html/markdown.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ impl<'a, 'b, 'ids, I: Iterator<Item = SpannedEvent<'a>>> Iterator
541541
for event in &mut self.inner {
542542
match &event.0 {
543543
Event::End(Tag::Heading(..)) => break,
544-
Event::Start(Tag::Link(_, _, _)) | Event::End(Tag::Link(..)) => {}
545544
Event::Text(text) | Event::Code(text) => {
546545
id.extend(text.chars().filter_map(slugify));
547546
self.buf.push_back(event);

src/librustdoc/html/markdown/tests.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ fn test_header() {
184184
<strong>Foo?</strong> &amp; *bar?!* <em><code>baz</code></em> ❤ #qux\
185185
</h5>",
186186
);
187+
t(
188+
"# Foo [bar](https://hello.yo)",
189+
"<h2 id=\"foo-bar\">\
190+
<a class=\"doc-anchor\" href=\"#foo-bar\">§</a>\
191+
Foo <a href=\"https://hello.yo\">bar</a>\
192+
</h2>",
193+
);
187194
}
188195

189196
#[test]

0 commit comments

Comments
 (0)