Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/doc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2355,8 +2355,10 @@ void highlightText(Scope *sc, Dsymbol *s, OutBuffer *buf, size_t offset)

OutBuffer codebuf;

// escape the contents, but do not perform highlighting
highlightCode3(sc, &codebuf, (utf8_t *)(buf->data + iCodeStart + 1), (utf8_t *)buf->data + i);
codebuf.write(buf->data + iCodeStart + 1, i - (iCodeStart + 1));

// escape the contents, but do not perform highlighting except for DDOC_PSYMBOL
highlightCode(sc, s, &codebuf, 0, false);

buf->remove(iCodeStart, i - iCodeStart + 1); // also trimming off the current `

Expand All @@ -2365,6 +2367,8 @@ void highlightText(Scope *sc, Dsymbol *s, OutBuffer *buf, size_t offset)
i = buf->insert(i, (char *)codebuf.data, codebuf.offset);
i = buf->insert(i, (char *)")", 1);

i--; // point to the ending ) so when the for loop does i++, it will see the next character

break;
}

Expand Down
11 changes: 11 additions & 0 deletions test/compilable/ddocbackticks.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh backticks

/++
Closely related to std.datetime is <a href="core_time.html">`core.time`</a>,
and some of the time types used in std.datetime come from there - such as
$(CXREF time, Duration), $(CXREF time, TickDuration), and
$(CXREF time, FracSec).
core.time is publically imported into std.datetime, it isn't necessary
to import it separately.
+/
module ddocbackticks;

/// This should produce `inline code`.
Expand All @@ -11,3 +19,6 @@ void test() {}
///
/// However, restarting on a new line should be `inline again`.
void test2() {}

/// This `int foo;` should show highlight on foo, but not int.
void foo() {}
13 changes: 12 additions & 1 deletion test/compilable/extra-files/ddocbackticks.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
<title>ddocbackticks</title>
</head><body>
<h1>ddocbackticks</h1>
<br><br>
Closely related to std.datetime is <a href="core_time.html"><pre style="display:inline;" class="d_inline_code">core.time</pre></a>,
and some of the time types used in std.datetime come from there - such as
, , and
.
core.time is publically imported into std.datetime, it isn't necessary
to import it separately.<br><br>

<dl><dt><big><a name="test"></a>void <u>test</u>();
</big></dt>
<dd>This should produce <pre style="display:inline;" class="d_inline_code">inline code</pre>.<br><br>
Expand All @@ -15,6 +21,11 @@ <h1>ddocbackticks</h1>
<br><br>
However, restarting on a new line should be <pre style="display:inline;" class="d_inline_code">inline again</pre>.<br><br>

</dd>
<dt><big><a name="foo"></a>void <u>foo</u>();
</big></dt>
<dd>This <pre style="display:inline;" class="d_inline_code">int <u>foo</u>;</pre> should show highlight on <u>foo</u>, but not int.<br><br>

</dd>
</dl>

Expand Down