Opened 14 years ago
Closed 13 years ago
#3953 closed enhancement (duplicate)
notebook -- make it so foo?? in the notebook shows the source code syntax highlighted
Reported by: | was | Owned by: | boothby |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | notebook | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Here's some relevant code by Gabriel Gellner -- a diff to server/support.py -- to this problem:
teragon-2:Downloads was$ diff ~/d/sage/sage/server/support.py support.py 23a24,29 > from pygments import highlight > from pygments.lexers import PythonLexer > from pygments.formatters import HtmlFormatter > > > 218,220c224,228 < src = sagedoc.format_src(src) < if not lineno is None: < src = "File: %s\nSource Code (starting at line %s):\n%s"%(filename, lineno, src) --- > #Slicing of the first 95 characters is a kluge to get rid of the doctype, > # really we should write our oun HtmlFormatter > src = highlight(src, PythonLexer(), HtmlFormatter(full=True))[94:] > #if not lineno is None: > # src = "File: %s\nSource Code (starting at line %s):\n%s"%(filename, lineno, src)
This requires the pygments library to be installed. Also, the notebook will have to be changed to not escape <'s etc. in the output of the source code window.
Change History (2)
comment:1 Changed 14 years ago by
Summary: | notebook -- make it so foo?? in the notebook shows the source code syntax highlighted → [duplicate of #5653, should be closed] notebook -- make it so foo?? in the notebook shows the source code syntax highlighted |
---|
comment:2 Changed 13 years ago by
Milestone: | sage-4.1.1 → sage-duplicate/invalid/wontfix |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
Summary: | [duplicate of #5653, should be closed] notebook -- make it so foo?? in the notebook shows the source code syntax highlighted → notebook -- make it so foo?? in the notebook shows the source code syntax highlighted |
Note: See
TracTickets for help on using
tickets.
This is a duplicate of #5653. Close it as per Mitesh Patel's suggestion.