diff --git a/src/doc.c b/src/doc.c index de6ccce1988d..a504bd0f78fb 100644 --- a/src/doc.c +++ b/src/doc.c @@ -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 ` @@ -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; } diff --git a/test/compilable/ddocbackticks.d b/test/compilable/ddocbackticks.d index 2afdd5e7f734..8249c4b00d3d 100644 --- a/test/compilable/ddocbackticks.d +++ b/test/compilable/ddocbackticks.d @@ -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 `core.time`, + 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`. @@ -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() {} diff --git a/test/compilable/extra-files/ddocbackticks.html b/test/compilable/extra-files/ddocbackticks.html index 2e7e4a037621..6acdf42d994c 100644 --- a/test/compilable/extra-files/ddocbackticks.html +++ b/test/compilable/extra-files/ddocbackticks.html @@ -3,7 +3,13 @@
core.time, + 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.
inline code.
inline again.
int foo;should show highlight on foo, but not int.