[PATCH] bugreport: use supported syntax for markdown highlighting

4 прагляды
Перайсці да першага непрачытанага паведамлення

Antonio Muci

не прачытана,
4 жні 2022 г., 04:49:414.08.22
да thg...@googlegroups.com,a....@inwind.it
# HG changeset patch
# User Antonio Muci <a....@inwind.it>
# Date 1659602831 -7200
# Thu Aug 04 10:47:11 2022 +0200
# Branch stable
# Node ID 0f999d374e2c99aa10d1b129af087b10e9239794
# Parent e8263ab945c23cb2a82cdb2639f008995f01b0bc
bugreport: use supported syntax for markdown highlighting

This code originally came from 44911621e0d9 and was meant for Bitbucket. At the
time, it was possible to format a block of text using a - now unsupported -
shebang syntax ("#!python"), see [0].

We have been on Heptapod for some time now, and the format for syntax
highlighting has stabilized around using "```language". The bug report text is
not proper python code, but the highlighting is indeed useful for looking at the
traceback.

This is a small addition to efb17b2cdedf.

[0] https://support.atlassian.com/bitbucket-cloud/docs/use-syntax-highlighting-in-a-wiki/

diff --git a/tortoisehg/hgqt/bugreport.py b/tortoisehg/hgqt/bugreport.py
--- a/tortoisehg/hgqt/bugreport.py
+++ b/tortoisehg/hgqt/bugreport.py
@@ -132,7 +132,7 @@ class BugReport(QDialog):
return hglib.tounicode(ext)

# TODO: make this more uniformly unicode safe
- text = '#!python\n'
+ text = '```python\n'
text += '** Mercurial version (%s). TortoiseHg version (%s)\n' % (
hglib.hgversion, version.version())
text += '** Command: %s\n' % (hglib.tounicode(opts.get('cmd', 'N/A')))
@@ -148,7 +148,8 @@ class BugReport(QDialog):
text += ('** Qt-%s PyQt-%s QScintilla-%s\n'
% (QT_VERSION_STR, PYQT_VERSION_STR, QSCINTILLA_VERSION_STR))
text += hglib.tounicode(opts.get('error', 'N/A'))
- return "```" + text + "```"
+ text += '\n```'
+ return text

def copyText(self):
QApplication.clipboard().setText(self.text)

Yuya Nishihara

не прачытана,
4 жні 2022 г., 06:03:164.08.22
да 'Antonio Muci' via TortoiseHg Developers,a....@inwind.it
On Thu, 04 Aug 2022 10:49:38 +0200, 'Antonio Muci' via TortoiseHg Developers wrote:
> # HG changeset patch
> # User Antonio Muci <a....@inwind.it>
> # Date 1659602831 -7200
> # Thu Aug 04 10:47:11 2022 +0200
> # Branch stable
> # Node ID 0f999d374e2c99aa10d1b129af087b10e9239794
> # Parent e8263ab945c23cb2a82cdb2639f008995f01b0bc
> bugreport: use supported syntax for markdown highlighting

Queued for stable, thanks.
Адказаць усім
Адказаць аўтару
Наперад
0 новых паведамленняў