Question

Is it possible to embed code to Trac wiki page straight from source code? I mean code blocks, not links pointing to the source. Like

MyCode.java contents

Was it helpful?

Solution

Look at IncludeMacro which is also able to embed from source repository (keyword source:).

Furthermore you can copy source code to wiki and format it with syntax-highlighting, for example:

{{{
#!python
hello = lambda: "world"
}}}

Read more about it here.

OTHER TIPS

You're using 'code blocks' in a way that makes me think of partial citation.

As falkb pointed out, IncludeMacro is the current best way of embedding Trac (and even external) content into a Trac resource, that is rendered with support for Trac's WikiFormatting. But sadly, there is NO such partial citation capability yet.

You may want to at least request it as enhancement for the aforementioned plugin, and could even push it closer to reality by providing valid use case example - or better: some real code to make it happen. Be prepared to test code, if a patch is proposed or - ideally - if the trunk (development) branch receives changes to make partial citation happen.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top