digitalmars.D - Is there a macro for code snippets introduced with "---"?
- Andrei Alexandrescu (21/21) Jul 03 2017 Trying to to this:
- Vladimir Panteleev (2/3) Jul 03 2017 D_CODE ?
- Andrei Alexandrescu (3/7) Jul 03 2017 That renders the code in constant-width font, but it's not colorized. --...
- =?UTF-8?Q?S=c3=b6nke_Ludwig?= (7/37) Jul 03 2017 The problem is that syntax highlighting of code blocks happens at an
- Andrei Alexandrescu (6/13) Jul 04 2017 Thanks. I think the best way to do it is to have the earlier stage
Trying to to this: //////////////// file.dd This will be highlighted: --- int i; --- This should also be but it isn't: $(MYMACRO int j; ) Macros: MYMACRO = Code begins --- $0 --- Code ends //////////////// file.dd ends The expansion doesn't result in highlighted code. Is there a macro equivalent for "---"? Thanks, Andrei
Jul 03 2017
On Monday, 3 July 2017 at 23:17:02 UTC, Andrei Alexandrescu wrote:Is there a macro equivalent for "---"?D_CODE ?
Jul 03 2017
On 7/3/17 7:19 PM, Vladimir Panteleev wrote:On Monday, 3 July 2017 at 23:17:02 UTC, Andrei Alexandrescu wrote:That renders the code in constant-width font, but it's not colorized. -- AndreiIs there a macro equivalent for "---"?D_CODE ?
Jul 03 2017
Am 04.07.2017 um 01:17 schrieb Andrei Alexandrescu:Trying to to this: //////////////// file.dd This will be highlighted: --- int i; --- This should also be but it isn't: $(MYMACRO int j; ) Macros: MYMACRO = Code begins --- $0 --- Code ends //////////////// file.dd ends The expansion doesn't result in highlighted code. Is there a macro equivalent for "---"? Thanks, AndreiThe problem is that syntax highlighting of code blocks happens at an earlier stage according to the spec (see "Phases of Processing" at http://dlang.org/spec/ddoc.html). I just checked and I'm actually doing it the other way around in DDOX, without encountering different results so far, so it may be realistic to change this for Ddoc, too.
Jul 03 2017
On 07/04/2017 12:37 AM, Sönke Ludwig wrote:The problem is that syntax highlighting of code blocks happens at an earlier stage according to the spec (see "Phases of Processing" at http://dlang.org/spec/ddoc.html). I just checked and I'm actually doing it the other way around in DDOX, without encountering different results so far, so it may be realistic to change this for Ddoc, too.Thanks. I think the best way to do it is to have the earlier stage transform all sugar (---, backticks, tags with colons, ...) to standard macros, and then make one pass that expands macros. That gives maximum control to the user and allows us to e.g. improve the sugar easily. -- Andrei
Jul 04 2017