diff --git a/NoteHighlightAddin/AddIn.cs b/NoteHighlightAddin/AddIn.cs index d3499fa..071cb2f 100644 --- a/NoteHighlightAddin/AddIn.cs +++ b/NoteHighlightAddin/AddIn.cs @@ -220,7 +220,7 @@ private void ShowForm() } } - MainForm form = new MainForm(tag, outFileName, selectedText, this.QuickStyle); + MainForm form = new MainForm(tag, outFileName, selectedText, this.QuickStyle, this.DarkMode); System.Windows.Forms.Application.Run(form); //} diff --git a/NoteHighlightAddin/MainForm.cs b/NoteHighlightAddin/MainForm.cs index e4fb93f..c0bcaed 100644 --- a/NoteHighlightAddin/MainForm.cs +++ b/NoteHighlightAddin/MainForm.cs @@ -29,6 +29,7 @@ public partial class MainForm : Form private string _fileName; private HighLightParameter _parameters; + private bool _darkMode; //要HighLight的Code private string CodeContent { get { return this.txtCode.Text; } } @@ -48,6 +49,8 @@ public partial class MainForm : Form private bool _quickStyle; + public bool DarkMode { get { return _darkMode; } } + [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern bool SetForegroundWindow(IntPtr hWnd); @@ -55,7 +58,7 @@ public partial class MainForm : Form #region -- Constructor -- - public MainForm(string codeType, string fileName, string selectedText, bool quickStyle) + public MainForm(string codeType, string fileName, string selectedText, bool quickStyle, bool darkMode) { _codeType = codeType; _fileName = fileName; @@ -63,6 +66,7 @@ public MainForm(string codeType, string fileName, string selectedText, bool quic LoadThemes(); txtCode.Text = selectedText; _quickStyle = quickStyle; + _darkMode = darkMode; if (_quickStyle) { @@ -192,6 +196,15 @@ private void InsertToClipboard(string outputFileName) string byteOrderMarkUtf8 = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()); line = line.Replace(byteOrderMarkUtf8, ""); + if (line.StartsWith("")) { line = line.Replace("\t", "    ").Replace("'", "'") + "
";