Skip to content

Commit 16ec84b

Browse files
author
Robin Kruppe
committed
Correct signature of hoedown callback for codespans
1 parent 316f5e5 commit 16ec84b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/librustdoc/html/markdown.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ type headerfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
7474
libc::c_int, *mut libc::c_void);
7575

7676
type codespanfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
77-
*mut libc::c_void);
77+
*mut libc::c_void) -> libc::c_int;
7878

7979
type linkfn = extern "C" fn (*mut hoedown_buffer, *const hoedown_buffer,
8080
*const hoedown_buffer, *const hoedown_buffer,
@@ -317,7 +317,11 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
317317

318318
reset_headers();
319319

320-
extern fn codespan(ob: *mut hoedown_buffer, text: *const hoedown_buffer, _: *mut libc::c_void) {
320+
extern fn codespan(
321+
ob: *mut hoedown_buffer,
322+
text: *const hoedown_buffer,
323+
_: *mut libc::c_void,
324+
) -> libc::c_int {
321325
let content = if text.is_null() {
322326
"".to_string()
323327
} else {
@@ -329,6 +333,8 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
329333
let content = format!("<code>{}</code>", Escape(&content));
330334
let element = CString::new(content).unwrap();
331335
unsafe { hoedown_buffer_puts(ob, element.as_ptr()); }
336+
// Return anything except 0, which would mean "also print the code span verbatim".
337+
1
332338
}
333339

334340
unsafe {

0 commit comments

Comments
 (0)