Edgewall Software

Opened 19 years ago

Last modified 9 years ago

#1520 new enhancement

Highlight TracLinks in browser

Reported by: shad Owned by:
Priority: normal Milestone: next-major-releases
Component: wiki system Version: 0.8.1
Severity: normal Keywords: mimeview postprocessing pygments comment
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

It would be nice to highlight TracLinks in browser file view.

For example to display ticket links when viewing source:trunk/ChangeLog@latest.

This is already possible by specifying text/x-trac-wiki as the mimetype for this kind of files

Another example would be to wiki format the inline Wiki syntax present in comments (this needs some cooperation from the syntax highlighter, e.g. the Pygments renderer).

Attachments (0)

Change History (13)

comment:1 by Christian Boos, 19 years ago

Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

This could be achieved by setting the svn:mime-type of the file to something like text/trac or application/x-trac

Then, a mimeprocessor doing a wiki_to_html() could be used for rendering the file.

comment:2 by Christian Boos, 19 years ago

Resolution: fixed
Status: assignedclosed

Idea above implemented in [1611]. This should be enough to correctly handle files like source:trunk/ChangeLog#latest.

Trying to detect TracLinks in all files would certainly be overkill…

However, one could add a post-processing step for enscript and/or ClearSilver highlighting, in order to look for TracLinks in the comments only. But this corresponds to a separate ticket, so I'm closing this one.

comment:3 by Christopher Lenz, 19 years ago

First, I don't think [1611] really addresses the request raised here. Are you expecting people to set the content type of their ChangeLog file to "text/x-trac-wiki" so that the ticket references get hyperlinked? Wouldn't that probably mess up the formatting of the change log?

Second, I don't see much value in the TracWikiRenderer personally, i.e. I don't really understand the use case. While the implementation surely is simple enough, I feel that it might be better provided by an option plugin, as opposed to part of the core functionality. But maybe you have some use cases in mind that I can't think of?

comment:4 by Christian Boos, 19 years ago

  1. Is it really such a problem to set the mime-type on a file in order to have it correctly highlighted? I can't see the problem here.
  2. The use case is pretty simple: most of the projects contain text documents like README, INSTALL.txt or such. Once developers are used to Trac's Wiki markup (because they are using the Trac Wiki for documentation purpose), they also tend naturally to use these conventions in other text documents. Then, while browsing those documents in Trac, it's also natural that they get formatted the expected way.
  3. If that approach is not correct, how would you have addressed this need, then?

comment:5 by Christopher Lenz, 19 years ago

The problem isn't setting the svn:mime-type property. The problem is that the files in question, for example README, ChangeLog or README.txt, are formatted as plain text. Treating them as if they contained Trac Wiki syntax will probably mess up the formatting. You argue that people will get used to using the Trac Wiki syntax and extend its use to the above files, which I doubt myself.

I'm not saying that I know a better solution to this request. I'm also not sure it's solvable in a "correct" way.

comment:6 by shad, 19 years ago

I haven't tryed setting the svn:mime-type yet (simple and elegant solution), but I think cmlenz is right - we don't need full power of wiki in text-files (though it could mess the formatting of plain text file), just a link highlighting is required.

For simple plaintext files like ChangeLog there should be enough svn:mime-type property (someting like text/x-trac-links), but what about source files (c++ in my case) - sources often contain links to tickets in comments. So I think it should be configurable (through TracIni) to allow parsing of TracLinks before showing any text-like file in the repository (through Browser.py).

comment:7 by Christian Boos, 19 years ago

Keywords: mimeview postprocessing added
Milestone: 0.9
Priority: normallow
Resolution: fixed
Severity: normalenhancement
Status: closedreopened

The text/x-trac-links idea is a good one. I also like the idea of TracLinks highlighting in C++ code comment.

There's also some material on the Mailing List on that issue:

(actually, have a look at for some prior art :) ).

comment:8 by Christian Boos, 19 years ago

See also #1292

comment:9 by Christian Boos, 17 years ago

Milestone: 2.0

comment:10 by Christian Boos, 17 years ago

Component: browserwiki

I'll find this one quicker next time I'll be looking for it ;-)

comment:11 by Christian Boos, 14 years ago

Milestone: 2.0unscheduled

Milestone 2.0 deleted

comment:12 by Christian Boos, 14 years ago

Description: modified (diff)
Keywords: pygments comment added
Milestone: triagingnext-major-0.1X
Priority: lownormal

See also #2523.

comment:13 by Ryan J Ollos, 9 years ago

Owner: Christian Boos removed
Status: reopenednew

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.