├── .gitattributes ├── .github └── ISSUE_TEMPLATE.md ├── .gitignore ├── LICENSE.md ├── MarkdownViewerPlusPlus.sln ├── MarkdownViewerPlusPlus ├── Forms │ ├── AboutDialog.Designer.cs │ ├── AboutDialog.cs │ ├── AboutDialog.resx │ ├── AbstractOptionsPanel.cs │ ├── AbstractRenderer.Designer.cs │ ├── AbstractRenderer.cs │ ├── AbstractRenderer.resx │ ├── MarkdownViewerHtmlPanel.cs │ ├── MarkdownViewerOptions.Designer.cs │ ├── MarkdownViewerOptions.cs │ ├── MarkdownViewerOptions.resx │ ├── MarkdownViewerRenderer.cs │ ├── OptionsPanelGeneral.Designer.cs │ ├── OptionsPanelGeneral.cs │ ├── OptionsPanelGeneral.resx │ ├── OptionsPanelHTML.Designer.cs │ ├── OptionsPanelHTML.cs │ ├── OptionsPanelHTML.resx │ ├── OptionsPanelPDF.Designer.cs │ ├── OptionsPanelPDF.cs │ └── OptionsPanelPDF.resx ├── Helper │ └── ClipboardHelper.cs ├── ILMerge.props ├── ILMergeOrder.txt ├── Main.cs ├── MarkdownViewer.cs ├── MarkdownViewerConfiguration.cs ├── MarkdownViewerPlusPlus.csproj ├── PluginInfrastructure │ ├── ClikeStringArray.cs │ ├── DllExport │ │ ├── DllExportAttribute.cs │ │ ├── Mono.Cecil.dll │ │ ├── NppPlugin.DllExport.MSBuild.dll │ │ ├── NppPlugin.DllExport.dll │ │ └── NppPlugin.DllExport.targets │ ├── Docking_h.cs │ ├── GatewayDomain.cs │ ├── IScintillaGateway.cs │ ├── MenuCmdID_h.cs │ ├── Msgs_h.cs │ ├── NotepadPPGateway.cs │ ├── NppPluginNETBase.cs │ ├── NppPluginNETHelper.cs │ ├── Preference_h.cs │ ├── Resource_h.cs │ ├── ScintillaGateway.cs │ ├── Scintilla_iface.cs │ ├── UnmanagedExports.cs │ └── Win32.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Resources │ ├── Donate-PayPal-green.png │ ├── MarkdownViewerHTML.css │ ├── MarkdownViewerPlusPlus-Options.png │ ├── MarkdownViewerPlusPlus.png │ ├── fa-clipboard-16x16.png │ ├── fa-cog-16x16.png │ ├── fa-download-16x16.png │ ├── fa-envelope-16x16.png │ ├── fa-file-pdf-o-16x16.png │ ├── fa-html5-16x16.png │ ├── fa-info-16x16.png │ ├── fa-paypal-16x16.png │ ├── fa-print-16x16.png │ ├── fa-refresh-16x16.png │ ├── fa-tv-16x16.png │ ├── fa-upload-16x16.png │ ├── markdown-16x16-solid.bmp │ └── markdown-16x16-solid.png ├── Windows │ └── WindowsMessage.cs ├── app.config └── packages.config ├── README.md ├── _config.yml ├── appveyor.yml └── license ├── Apache-2.0-License.md ├── HtmlRenderer-License.md ├── Markdig-License.md ├── Ms-PL-License.md ├── OFL.txt └── PDFSharp-License.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Issue description 2 | _Please describe your issue and expected result_ 3 | 4 | ### Markdown to reproduce 5 | ``` 6 | Please post the markdown code producing the described issue, if any 7 | ``` 8 | 9 | ### Screenshot 10 | _If available_ 11 | 12 | ### Environment 13 | * Notepad++ _X.Y.Z (x86/x64)_ 14 | * MarkdownViewer++ _X.Y.Z_ 15 | * Windows _7/8/10 (x86/x64)_ 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # MSTest test Results 33 | [Tt]est[Rr]esult*/ 34 | [Bb]uild[Ll]og.* 35 | 36 | # NUNIT 37 | *.VisualState.xml 38 | TestResult.xml 39 | 40 | # Build Results of an ATL Project 41 | [Dd]ebugPS/ 42 | [Rr]eleasePS/ 43 | dlldata.c 44 | 45 | # .NET Core 46 | project.lock.json 47 | project.fragment.lock.json 48 | artifacts/ 49 | **/Properties/launchSettings.json 50 | 51 | *_i.c 52 | *_p.c 53 | *_i.h 54 | *.ilk 55 | *.meta 56 | *.obj 57 | *.pch 58 | *.pdb 59 | *.pgc 60 | *.pgd 61 | *.rsp 62 | *.sbr 63 | *.tlb 64 | *.tli 65 | *.tlh 66 | *.tmp 67 | *.tmp_proj 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | *.pidb 73 | *.svclog 74 | *.scc 75 | 76 | # Chutzpah Test files 77 | _Chutzpah* 78 | 79 | # Visual C++ cache files 80 | ipch/ 81 | *.aps 82 | *.ncb 83 | *.opendb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | *.VC.db 88 | *.VC.VC.opendb 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | *.sap 95 | 96 | # TFS 2012 Local Workspace 97 | $tf/ 98 | 99 | # Guidance Automation Toolkit 100 | *.gpState 101 | 102 | # ReSharper is a .NET coding add-in 103 | _ReSharper*/ 104 | *.[Rr]e[Ss]harper 105 | *.DotSettings.user 106 | 107 | # JustCode is a .NET coding add-in 108 | .JustCode 109 | 110 | # TeamCity is a build add-in 111 | _TeamCity* 112 | 113 | # DotCover is a Code Coverage Tool 114 | *.dotCover 115 | 116 | # Visual Studio code coverage results 117 | *.coverage 118 | *.coveragexml 119 | 120 | # NCrunch 121 | _NCrunch_* 122 | .*crunch*.local.xml 123 | nCrunchTemp_* 124 | 125 | # MightyMoose 126 | *.mm.* 127 | AutoTest.Net/ 128 | 129 | # Web workbench (sass) 130 | .sass-cache/ 131 | 132 | # Installshield output folder 133 | [Ee]xpress/ 134 | 135 | # DocProject is a documentation generator add-in 136 | DocProject/buildhelp/ 137 | DocProject/Help/*.HxT 138 | DocProject/Help/*.HxC 139 | DocProject/Help/*.hhc 140 | DocProject/Help/*.hhk 141 | DocProject/Help/*.hhp 142 | DocProject/Help/Html2 143 | DocProject/Help/html 144 | 145 | # Click-Once directory 146 | publish/ 147 | 148 | # Publish Web Output 149 | *.[Pp]ublish.xml 150 | *.azurePubxml 151 | # TODO: Comment the next line if you want to checkin your web deploy settings 152 | # but database connection strings (with potential passwords) will be unencrypted 153 | *.pubxml 154 | *.publishproj 155 | 156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 157 | # checkin your Azure Web App publish settings, but sensitive information contained 158 | # in these scripts will be unencrypted 159 | PublishScripts/ 160 | 161 | # NuGet Packages 162 | *.nupkg 163 | # The packages folder can be ignored because of Package Restore 164 | **/packages/* 165 | # except build/, which is used as an MSBuild target. 166 | !**/packages/build/ 167 | # Uncomment if necessary however generally it will be regenerated when needed 168 | #!**/packages/repositories.config 169 | # NuGet v3's project.json files produces more ignoreable files 170 | *.nuget.props 171 | *.nuget.targets 172 | 173 | # Microsoft Azure Build Output 174 | csx/ 175 | *.build.csdef 176 | 177 | # Microsoft Azure Emulator 178 | ecf/ 179 | rcf/ 180 | 181 | # Windows Store app package directories and files 182 | AppPackages/ 183 | BundleArtifacts/ 184 | Package.StoreAssociation.xml 185 | _pkginfo.txt 186 | 187 | # Visual Studio cache files 188 | # files ending in .cache can be ignored 189 | *.[Cc]ache 190 | # but keep track of directories ending in .cache 191 | !*.[Cc]ache/ 192 | 193 | # Others 194 | ClientBin/ 195 | ~$* 196 | *~ 197 | *.dbmdl 198 | *.dbproj.schemaview 199 | *.jfm 200 | *.pfx 201 | *.publishsettings 202 | node_modules/ 203 | orleans.codegen.cs 204 | 205 | # Since there are multiple workflows, uncomment next line to ignore bower_components 206 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 207 | #bower_components/ 208 | 209 | # RIA/Silverlight projects 210 | Generated_Code/ 211 | 212 | # Backup & report files from converting an old project file 213 | # to a newer Visual Studio version. Backup files are not needed, 214 | # because we have git ;-) 215 | _UpgradeReport_Files/ 216 | Backup*/ 217 | UpgradeLog*.XML 218 | UpgradeLog*.htm 219 | 220 | # SQL Server files 221 | *.mdf 222 | *.ldf 223 | 224 | # Business Intelligence projects 225 | *.rdl.data 226 | *.bim.layout 227 | *.bim_*.settings 228 | 229 | # Microsoft Fakes 230 | FakesAssemblies/ 231 | 232 | # GhostDoc plugin setting file 233 | *.GhostDoc.xml 234 | 235 | # Node.js Tools for Visual Studio 236 | .ntvs_analysis.dat 237 | 238 | # Visual Studio 6 build log 239 | *.plg 240 | 241 | # Visual Studio 6 workspace options file 242 | *.opt 243 | 244 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 245 | *.vbw 246 | 247 | # Visual Studio LightSwitch build output 248 | **/*.HTMLClient/GeneratedArtifacts 249 | **/*.DesktopClient/GeneratedArtifacts 250 | **/*.DesktopClient/ModelManifest.xml 251 | **/*.Server/GeneratedArtifacts 252 | **/*.Server/ModelManifest.xml 253 | _Pvt_Extensions 254 | 255 | # Paket dependency manager 256 | .paket/paket.exe 257 | paket-files/ 258 | 259 | # FAKE - F# Make 260 | .fake/ 261 | 262 | # JetBrains Rider 263 | .idea/ 264 | *.sln.iml 265 | 266 | # CodeRush 267 | .cr/ 268 | 269 | # Python Tools for Visual Studio (PTVS) 270 | __pycache__/ 271 | *.pyc 272 | 273 | # Cake - Uncomment if you are using it 274 | # tools/** 275 | # !tools/packages.config 276 | /_site 277 | /Gemfile.lock 278 | /Gemfile 279 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Savas Ziplies 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarkdownViewerPlusPlus", "MarkdownViewerPlusPlus\MarkdownViewerPlusPlus.csproj", "{E56F6E12-089C-40ED-BCFD-923E5FA121A1}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x64.ActiveCfg = Debug|x64 21 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x64.Build.0 = Debug|x64 22 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x86.ActiveCfg = Debug|x86 23 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x86.Build.0 = Debug|x86 24 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x64.ActiveCfg = Release|x64 27 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x64.Build.0 = Release|x64 28 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x86.ActiveCfg = Release|x86 29 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x86.Build.0 = Release|x86 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/AboutDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 2 | { 3 | partial class AboutDialog 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.btnClose = new System.Windows.Forms.Button(); 32 | this.btnVisit = new System.Windows.Forms.Button(); 33 | this.lblAbout = new System.Windows.Forms.Label(); 34 | this.picBoxDonate = new System.Windows.Forms.PictureBox(); 35 | ((System.ComponentModel.ISupportInitialize)(this.picBoxDonate)).BeginInit(); 36 | this.SuspendLayout(); 37 | // 38 | // btnClose 39 | // 40 | this.btnClose.Location = new System.Drawing.Point(212, 254); 41 | this.btnClose.Name = "btnClose"; 42 | this.btnClose.Size = new System.Drawing.Size(94, 23); 43 | this.btnClose.TabIndex = 0; 44 | this.btnClose.Text = "Close"; 45 | this.btnClose.UseVisualStyleBackColor = true; 46 | this.btnClose.Click += new System.EventHandler(this.btnClose_Click); 47 | // 48 | // btnVisit 49 | // 50 | this.btnVisit.Location = new System.Drawing.Point(12, 254); 51 | this.btnVisit.Name = "btnVisit"; 52 | this.btnVisit.Size = new System.Drawing.Size(94, 23); 53 | this.btnVisit.TabIndex = 1; 54 | this.btnVisit.Text = "Visit Website"; 55 | this.btnVisit.UseVisualStyleBackColor = true; 56 | this.btnVisit.Click += new System.EventHandler(this.btnVisit_Click); 57 | // 58 | // lblAbout 59 | // 60 | this.lblAbout.Location = new System.Drawing.Point(13, 13); 61 | this.lblAbout.Name = "lblAbout"; 62 | this.lblAbout.Size = new System.Drawing.Size(259, 238); 63 | this.lblAbout.TabIndex = 2; 64 | // 65 | // picBoxDonate 66 | // 67 | this.picBoxDonate.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; 68 | this.picBoxDonate.Image = global::com.insanitydesign.MarkdownViewerPlusPlus.Properties.Resources.Donate_PayPal_green; 69 | this.picBoxDonate.InitialImage = null; 70 | this.picBoxDonate.Location = new System.Drawing.Point(112, 254); 71 | this.picBoxDonate.Name = "picBoxDonate"; 72 | this.picBoxDonate.Size = new System.Drawing.Size(94, 23); 73 | this.picBoxDonate.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; 74 | this.picBoxDonate.TabIndex = 3; 75 | this.picBoxDonate.TabStop = false; 76 | this.picBoxDonate.Click += new System.EventHandler(this.picBoxDonate_Click); 77 | // 78 | // AboutDialog 79 | // 80 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 81 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 82 | this.ClientSize = new System.Drawing.Size(318, 289); 83 | this.Controls.Add(this.picBoxDonate); 84 | this.Controls.Add(this.lblAbout); 85 | this.Controls.Add(this.btnVisit); 86 | this.Controls.Add(this.btnClose); 87 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 88 | this.MaximizeBox = false; 89 | this.MinimizeBox = false; 90 | this.Name = "AboutDialog"; 91 | this.ShowIcon = false; 92 | this.ShowInTaskbar = false; 93 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 94 | this.Text = "About MarkdownViewer++"; 95 | ((System.ComponentModel.ISupportInitialize)(this.picBoxDonate)).EndInit(); 96 | this.ResumeLayout(false); 97 | 98 | } 99 | 100 | #endregion 101 | 102 | private System.Windows.Forms.Button btnClose; 103 | private System.Windows.Forms.Button btnVisit; 104 | private System.Windows.Forms.Label lblAbout; 105 | private System.Windows.Forms.PictureBox picBoxDonate; 106 | } 107 | } -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/AboutDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Windows.Forms; 4 | 5 | /// 6 | /// 7 | /// 8 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 9 | { 10 | /// 11 | /// About Dialog for this plugin with basic information and link to the website. 12 | /// 13 | public partial class AboutDialog : Form 14 | { 15 | /// 16 | /// Init the about dialog text from the Assembly Information 17 | /// 18 | public AboutDialog() 19 | { 20 | InitializeComponent(); 21 | 22 | //Get the assembly information for the About dialog 23 | string title = ((AssemblyTitleAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute), false)).Title; 24 | string description = ((AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute), false)).Description; 25 | string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); 26 | //About Text 27 | this.lblAbout.Text = $@"{title} 28 | 29 | {description} 30 | 31 | Version: {version} 32 | 33 | Many thanks to: 34 | Notepad++ PluginPack.net by kbilsted 35 | Markdig by lunet-io 36 | PDFSharp by empira Software GmbH 37 | HTMLRenderer by ArthurHub 38 | SVG.NET by vvvv 39 | FontAwesome 40 | dcurtis 41 | 42 | For more information, visit the website or check the included README.md 43 | "; 44 | } 45 | 46 | /// 47 | /// 48 | /// 49 | /// 50 | /// 51 | private void btnClose_Click(object sender, System.EventArgs e) 52 | { 53 | this.Close(); 54 | } 55 | 56 | /// 57 | /// Visit GitHub 58 | /// 59 | /// 60 | /// 61 | private void btnVisit_Click(object sender, System.EventArgs e) 62 | { 63 | System.Diagnostics.Process.Start("https://github.com/nea/MarkdownViewerPlusPlus"); 64 | } 65 | 66 | /// 67 | /// 68 | /// 69 | /// 70 | /// 71 | private void picBoxDonate_Click(object sender, EventArgs e) 72 | { 73 | System.Diagnostics.Process.Start("https://www.paypal.me/insanitydesign"); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/AboutDialog.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/AbstractOptionsPanel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewerConfiguration; 4 | 5 | /// 6 | /// 7 | /// 8 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 9 | { 10 | /// 11 | /// Abstract class not being abstract for Designer compatibility 12 | /// 13 | public class AbstractOptionsPanel : UserControl 14 | { 15 | /// 16 | /// 17 | /// 18 | public AbstractOptionsPanel() 19 | { 20 | // 21 | this.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 22 | this.Dock = DockStyle.Fill; 23 | // 24 | InitializeComponent(); 25 | } 26 | 27 | /// 28 | /// Load all options from the local Options instance 29 | /// onto the panel. 30 | /// 31 | public virtual void LoadOptions(Options options) 32 | { 33 | throw new NotImplementedException(); 34 | } 35 | 36 | /// 37 | /// Save the made selections/entries of the panel 38 | /// in the local Options instance. 39 | /// 40 | public virtual void SaveOptions(ref Options options) 41 | { 42 | throw new NotImplementedException(); 43 | } 44 | 45 | /// 46 | /// 47 | /// 48 | protected virtual void InitializeComponent() 49 | { 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/AbstractRenderer.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs: -------------------------------------------------------------------------------- 1 | using TheArtOfDev.HtmlRenderer.WinForms; 2 | 3 | /// 4 | /// 5 | /// 6 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 7 | { 8 | /// 9 | /// 10 | /// 11 | public class MarkdownViewerHtmlPanel : HtmlPanel 12 | { 13 | /// 14 | /// 15 | /// 16 | public MarkdownViewerHtmlPanel() 17 | { 18 | this.AllowDrop = false; 19 | this.Dock = System.Windows.Forms.DockStyle.Fill; 20 | this.IsContextMenuEnabled = false; 21 | this.Location = new System.Drawing.Point(0, 24); 22 | this.MinimumSize = new System.Drawing.Size(20, 20); 23 | this.Name = "markdownViewerHtmlPanel"; 24 | this.Size = new System.Drawing.Size(284, 237); 25 | this.TabIndex = 0; 26 | this.AvoidImagesLateLoading = false; 27 | } 28 | 29 | /// 30 | /// 31 | /// 32 | public override string Text { 33 | get { return _text; } 34 | set { 35 | _text = value; 36 | if (!IsDisposed) 37 | { 38 | _htmlContainer.SetHtml(_text, _baseCssData); 39 | Redraw(); 40 | } 41 | } 42 | } 43 | 44 | /// 45 | /// Scroll by the given ratio, calculated with max and page 46 | /// 47 | /// 48 | public void ScrollByRatioVertically(double scrollRatio) 49 | { 50 | if (!IsDisposed) 51 | { 52 | VerticalScroll.Value = (int)((VerticalScroll.Maximum - VerticalScroll.LargeChange) * scrollRatio); 53 | Redraw(); 54 | } 55 | } 56 | 57 | /// 58 | /// 59 | /// 60 | protected void Redraw() 61 | { 62 | PerformLayout(); 63 | Invalidate(); 64 | InvokeMouseMove(); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/MarkdownViewerOptions.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 2 | { 3 | partial class MarkdownViewerOptions 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | // 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.components = new System.ComponentModel.Container(); 33 | System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("General"); 34 | System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("HTML", 1, 1); 35 | System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("PDF", 2, 2); 36 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MarkdownViewerOptions)); 37 | this.btnOptionsSave = new System.Windows.Forms.Button(); 38 | this.btnOptionsCancel = new System.Windows.Forms.Button(); 39 | this.splitOptions = new System.Windows.Forms.SplitContainer(); 40 | this.treeOptions = new System.Windows.Forms.TreeView(); 41 | this.imgOptions = new System.Windows.Forms.ImageList(this.components); 42 | ((System.ComponentModel.ISupportInitialize)(this.splitOptions)).BeginInit(); 43 | this.splitOptions.Panel1.SuspendLayout(); 44 | this.splitOptions.SuspendLayout(); 45 | this.SuspendLayout(); 46 | // 47 | // btnOptionsSave 48 | // 49 | this.btnOptionsSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 50 | this.btnOptionsSave.Location = new System.Drawing.Point(455, 312); 51 | this.btnOptionsSave.Name = "btnOptionsSave"; 52 | this.btnOptionsSave.Size = new System.Drawing.Size(75, 23); 53 | this.btnOptionsSave.TabIndex = 0; 54 | this.btnOptionsSave.Text = "Save"; 55 | this.btnOptionsSave.UseVisualStyleBackColor = true; 56 | this.btnOptionsSave.Click += new System.EventHandler(this.btnOptionsSave_Click); 57 | // 58 | // btnOptionsCancel 59 | // 60 | this.btnOptionsCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 61 | this.btnOptionsCancel.CausesValidation = false; 62 | this.btnOptionsCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 63 | this.btnOptionsCancel.Location = new System.Drawing.Point(374, 312); 64 | this.btnOptionsCancel.Name = "btnOptionsCancel"; 65 | this.btnOptionsCancel.Size = new System.Drawing.Size(75, 23); 66 | this.btnOptionsCancel.TabIndex = 1; 67 | this.btnOptionsCancel.Text = "Cancel"; 68 | this.btnOptionsCancel.UseVisualStyleBackColor = true; 69 | this.btnOptionsCancel.Click += new System.EventHandler(this.btnOptionsCancel_Click); 70 | // 71 | // splitOptions 72 | // 73 | this.splitOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 74 | | System.Windows.Forms.AnchorStyles.Left) 75 | | System.Windows.Forms.AnchorStyles.Right))); 76 | this.splitOptions.Location = new System.Drawing.Point(0, 0); 77 | this.splitOptions.Margin = new System.Windows.Forms.Padding(10); 78 | this.splitOptions.Name = "splitOptions"; 79 | // 80 | // splitOptions.Panel1 81 | // 82 | this.splitOptions.Panel1.Controls.Add(this.treeOptions); 83 | this.splitOptions.Size = new System.Drawing.Size(530, 306); 84 | this.splitOptions.SplitterDistance = 135; 85 | this.splitOptions.TabIndex = 2; 86 | // 87 | // treeOptions 88 | // 89 | this.treeOptions.Dock = System.Windows.Forms.DockStyle.Fill; 90 | this.treeOptions.FullRowSelect = true; 91 | this.treeOptions.HideSelection = false; 92 | this.treeOptions.ImageIndex = 0; 93 | this.treeOptions.ImageList = this.imgOptions; 94 | this.treeOptions.Location = new System.Drawing.Point(0, 0); 95 | this.treeOptions.Name = "treeOptions"; 96 | treeNode1.Checked = true; 97 | treeNode1.Name = "nodeGeneral"; 98 | treeNode1.Tag = "OptionsPanelGeneral"; 99 | treeNode1.Text = "General"; 100 | treeNode2.ImageIndex = 1; 101 | treeNode2.Name = "nodeHTML"; 102 | treeNode2.SelectedImageIndex = 1; 103 | treeNode2.Tag = "OptionsPanelHTML"; 104 | treeNode2.Text = "HTML"; 105 | treeNode3.ImageIndex = 2; 106 | treeNode3.Name = "nodePDF"; 107 | treeNode3.SelectedImageIndex = 2; 108 | treeNode3.Tag = "OptionsPanelPDF"; 109 | treeNode3.Text = "PDF"; 110 | this.treeOptions.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { 111 | treeNode1, 112 | treeNode2, 113 | treeNode3}); 114 | this.treeOptions.SelectedImageIndex = 0; 115 | this.treeOptions.Size = new System.Drawing.Size(135, 306); 116 | this.treeOptions.TabIndex = 0; 117 | // 118 | // imgOptions 119 | // 120 | this.imgOptions.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgOptions.ImageStream"))); 121 | this.imgOptions.TransparentColor = System.Drawing.Color.Transparent; 122 | this.imgOptions.Images.SetKeyName(0, "markdown-16x16-solid.png"); 123 | this.imgOptions.Images.SetKeyName(1, "fa-html5-16x16.png"); 124 | this.imgOptions.Images.SetKeyName(2, "fa-file-pdf-o-16x16.png"); 125 | // 126 | // MarkdownViewerOptions 127 | // 128 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 129 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 130 | this.CancelButton = this.btnOptionsCancel; 131 | this.ClientSize = new System.Drawing.Size(534, 341); 132 | this.Controls.Add(this.splitOptions); 133 | this.Controls.Add(this.btnOptionsCancel); 134 | this.Controls.Add(this.btnOptionsSave); 135 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 136 | this.MaximizeBox = false; 137 | this.MinimizeBox = false; 138 | this.MinimumSize = new System.Drawing.Size(550, 380); 139 | this.Name = "MarkdownViewerOptions"; 140 | this.ShowIcon = false; 141 | this.ShowInTaskbar = false; 142 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 143 | this.Text = "Options - MarkdownViewer++"; 144 | this.splitOptions.Panel1.ResumeLayout(false); 145 | ((System.ComponentModel.ISupportInitialize)(this.splitOptions)).EndInit(); 146 | this.splitOptions.ResumeLayout(false); 147 | this.ResumeLayout(false); 148 | 149 | } 150 | 151 | #endregion 152 | 153 | private System.Windows.Forms.Button btnOptionsSave; 154 | private System.Windows.Forms.Button btnOptionsCancel; 155 | private System.Windows.Forms.SplitContainer splitOptions; 156 | private System.Windows.Forms.TreeView treeOptions; 157 | private System.Windows.Forms.ImageList imgOptions; 158 | } 159 | } -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/MarkdownViewerOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewerConfiguration; 6 | 7 | /// 8 | /// 9 | /// 10 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 11 | { 12 | /// 13 | /// 14 | /// 15 | public partial class MarkdownViewerOptions : Form 16 | { 17 | /// 18 | /// 19 | /// 20 | protected MarkdownViewerConfiguration configuration; 21 | 22 | /// 23 | /// 24 | /// 25 | protected Dictionary optionPanels = new Dictionary(); 26 | 27 | /// 28 | /// 29 | /// 30 | /// 31 | protected delegate void SaveHandler(ref Options options); 32 | 33 | /// 34 | /// 35 | /// 36 | protected SaveHandler SaveEvent; 37 | 38 | /// 39 | /// 40 | /// 41 | /// 42 | protected delegate void LoadHandler(Options options); 43 | 44 | /// 45 | /// 46 | /// 47 | protected LoadHandler LoadEvent; 48 | 49 | /// 50 | /// 51 | /// 52 | public MarkdownViewerOptions(ref MarkdownViewerConfiguration configuration) 53 | { 54 | // 55 | this.configuration = configuration; 56 | // 57 | InitializeComponent(); 58 | //Iterate over all menu items and register their classes 59 | string thisNamespace = typeof(MarkdownViewerOptions).Namespace; 60 | foreach (TreeNode node in this.treeOptions.Nodes) 61 | { 62 | AbstractOptionsPanel optionsPanel = (AbstractOptionsPanel)Activator.CreateInstance(Type.GetType(thisNamespace + "." + node.Tag.ToString())); 63 | this.SaveEvent += optionsPanel.SaveOptions; 64 | this.LoadEvent += optionsPanel.LoadOptions; 65 | //Add to map to store for changes 66 | this.optionPanels.Add(node.Tag.ToString(), optionsPanel); 67 | } 68 | // 69 | this.treeOptions.AfterSelect += treeOptions_AfterSelect; 70 | //Start with the general options panel 71 | this.splitOptions.Panel2.Controls.Add(this.optionPanels.First().Value); 72 | this.treeOptions.Select(); 73 | //Set the according dialog result to their respective buttons 74 | this.btnOptionsCancel.DialogResult = DialogResult.Cancel; 75 | this.btnOptionsSave.DialogResult = DialogResult.OK; 76 | // 77 | this.LoadEvent(this.configuration.options); 78 | } 79 | 80 | /// 81 | /// 82 | /// 83 | /// 84 | /// 85 | protected void treeOptions_AfterSelect(object sender, TreeViewEventArgs treeNodeEvent) 86 | { 87 | //Remove old (if any) 88 | if (this.splitOptions.Panel2.Controls.Count > 0) 89 | { 90 | this.splitOptions.Panel2.Controls.RemoveAt(0); 91 | } 92 | //Add selected options panel 93 | AbstractOptionsPanel optionPanel = this.optionPanels.Where(entry => entry.Key == treeNodeEvent.Node.Tag.ToString()).First().Value; 94 | this.splitOptions.Panel2.Controls.Add(optionPanel); 95 | } 96 | 97 | /// 98 | /// 99 | /// 100 | /// 101 | /// 102 | private void btnOptionsCancel_Click(object sender, System.EventArgs e) 103 | { 104 | this.Dispose(); 105 | } 106 | 107 | /// 108 | /// 109 | /// 110 | /// 111 | /// 112 | private void btnOptionsSave_Click(object sender, System.EventArgs e) 113 | { 114 | //Fire the save event for all listeners 115 | this.SaveEvent(ref this.configuration.options); 116 | //Save to init 117 | this.configuration.Save(); 118 | //Close the options dialog when all has been done 119 | this.Dispose(); 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/MarkdownViewerOptions.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 125 | AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w 126 | LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 127 | ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADm 128 | CQAAAk1TRnQBSQFMAgEBAwEAAUABAAFAAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo 129 | AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA 130 | AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 131 | AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA 132 | AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm 133 | AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM 134 | AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA 135 | ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz 136 | AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ 137 | AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM 138 | AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA 139 | AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA 140 | AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ 141 | AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ 142 | AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA 143 | AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm 144 | ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ 145 | Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz 146 | AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA 147 | AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM 148 | AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM 149 | ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM 150 | Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA 151 | AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM 152 | AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ 153 | AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz 154 | AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm 155 | AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw 156 | AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/xUAAf8B9ALvAfMB/wgA 157 | C/8kAAH/AfABbQYAARIBvAH/BAABbQsAAW0jAAHtCgABFAUAAf8JAAH/EwAB6g4AAeoBAAHqAgABEwG8 158 | AvQBvAETCAAB/wHyAfQHAAH/JAABDwEAAfMGAAH0AgAB/wQAAv8B7wH/BgAB/xUAAW0B7wMAAe8BbQIA 159 | ARIBDgMAAf8CAAH/AQAB8gHtAewB8QEAAf8CAAH/BAAB/wIAAfAB9AP/AfEB8AH/FQAB7wIAARICAAHv 160 | AQABEgH/AfADAAH/AgAB/wUAAv8CAAH/BAAB/wIAAf8B8wH/AW0BBwHwAfQB/xUAAe8BAAFtAf8BbQEA 161 | Ae8BFQH/AgABBwIAAf8CAAYSAf8DAAH0BAAB/wMAAbwB8wH0AwAB/xUAAe8BAAH/AfMB/wEAAe8DAAHv 162 | AwAB/wIAAf8HAAEVAQAB8wQAAf8DAAH0AQcEAAH/FQAB7wEAAfIBAAHyAQAB7wMAAe8DAAH0AQABEAgA 163 | AesBAAHxBAAB/wMAAf8B9AQAAf8VAAFtAe8BEQEAAREB7wFtAgAB7wFtAwAB8gEAAW0BAAH/CAABvAQA 164 | Af8DAAH0Af8CAAP/IwAB8AEAAZIBAAH/BusBEQEAAe8EAAH/AwAB9AH/AQABFQMAARASAAFtDgABbQEH 165 | AQABBwgAAfEBAAHsBAAB/wUAAf8DAAHyAfAiAAGSAQABDggQAQ4BAAEUBAAB/wUAAf8CAAHyAQcjAAFt 166 | EQAH/wEAAfIBByQAARANAAH/AgAB7AcAARAB8BUAAUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEB 167 | BQABgBcAA/8BAAL/AfABPwHAAQcCAAL/AYABBwGAAQMCAAL/AYABBwGfAfMEAAGAAQcBhwHzBAABjwHD 168 | AYMB8wQAAQgBQwGYAQMCAAERAQABCAEDAZgBAwIAAREBGAEAASMBnAFzAgABEQEQAQ8B4wGcAfMCAAER 169 | ARABHwHjAZwB8wQAARABAwGcAcMEAAEQAQMBnAGDBAABHwHjAZ8BMwIAAv8BAAEDAZ8BJwIAAv8BAAED 170 | AYABDwIAAv8BAAEBAYABHwIACw== 171 | 172 | 173 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/MarkdownViewerRenderer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Svg; 4 | using System.Drawing; 5 | using System.Drawing.Imaging; 6 | using System.Net; 7 | using System.Threading; 8 | using TheArtOfDev.HtmlRenderer.Core.Entities; 9 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewer; 10 | 11 | /// 12 | /// 13 | /// 14 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 15 | { 16 | /// 17 | /// 18 | /// 19 | public class MarkdownViewerRenderer : AbstractRenderer 20 | { 21 | /// 22 | /// 23 | /// 24 | public MarkdownViewerHtmlPanel markdownViewerHtmlPanel; 25 | 26 | /// 27 | /// 28 | /// 29 | /// 30 | public MarkdownViewerRenderer(MarkdownViewer markdownViewer) : base(markdownViewer) 31 | { 32 | } 33 | 34 | /// 35 | /// 36 | /// 37 | protected override void Init() 38 | { 39 | base.Init(); 40 | // 41 | this.markdownViewerHtmlPanel = new MarkdownViewerHtmlPanel(); 42 | //Add a custom image loader 43 | this.markdownViewerHtmlPanel.ImageLoad += OnImageLoad; 44 | //Add to view 45 | this.Controls.Add(this.markdownViewerHtmlPanel); 46 | this.Controls.SetChildIndex(this.markdownViewerHtmlPanel, 0); 47 | } 48 | 49 | /// 50 | /// 51 | /// 52 | /// 53 | /// 54 | public override void Render(string text, FileInformation fileInfo) 55 | { 56 | base.Render(text, fileInfo); 57 | this.markdownViewerHtmlPanel.Text = BuildHtml(ConvertedText, fileInfo.FileName); 58 | } 59 | 60 | /// 61 | /// Scroll the rendered panel vertically based on the given ration 62 | /// taken from Notepad++ 63 | /// 64 | /// 65 | public override void ScrollByRatioVertically(double scrollRatio) 66 | { 67 | this.markdownViewerHtmlPanel.ScrollByRatioVertically(scrollRatio); 68 | } 69 | 70 | /// 71 | /// Custom renderer for SVG images in the markdown as not supported natively. 72 | /// @see https://htmlrenderer.codeplex.com/wikipage?title=Rendering%20SVG%20images 73 | /// 74 | /// 75 | /// 76 | protected void OnImageLoad(object sender, HtmlImageLoadEventArgs imageLoadEvent) 77 | { 78 | try 79 | { 80 | //Get some file information 81 | string src = imageLoadEvent.Src; 82 | Uri uri = new Uri(src); 83 | string extension = Path.GetExtension(src); 84 | 85 | //Check if local file or web resource 86 | switch (uri.Scheme.ToLowerInvariant()) 87 | { 88 | case "file": 89 | //In case of a local file -> Try to load it directly 90 | imageLoadEvent.Handled = true; //Tell the event it was handled, so no error border is drawn 91 | ThreadPool.QueueUserWorkItem(state => LoadImageFromFile(src, imageLoadEvent)); 92 | break; 93 | case "http": 94 | case "https": 95 | //For web resources check extension and parameter, to fetch from e.g. "badge" creating sources 96 | if ((extension != null && extension.Equals(".svg", StringComparison.OrdinalIgnoreCase)) 97 | || uri.ToString().Contains("svg=")) 98 | { 99 | //In case of a web resource file -> Load async 100 | using (WebClient webClient = new WebClient()) 101 | { 102 | imageLoadEvent.Handled = true; //Tell the event it was handled, so no error border is drawn 103 | webClient.DownloadDataCompleted += (downloadSender, downloadEvent) => { OnDownloadDataCompleted(downloadEvent, imageLoadEvent); }; 104 | webClient.DownloadDataAsync(uri); 105 | } 106 | } 107 | break; 108 | } 109 | 110 | } 111 | catch 112 | { 113 | } 114 | } 115 | 116 | /// 117 | /// 118 | /// 119 | /// 120 | /// 121 | protected void LoadImageFromFile(string src, HtmlImageLoadEventArgs imageLoadEvent) 122 | { 123 | try 124 | { 125 | Uri uri = new Uri(src); 126 | //Try to load the file as Image from file 127 | //Remove the scheme first 128 | string srcWithoutScheme = src; 129 | int i = srcWithoutScheme.IndexOf(':'); 130 | if (i > 0) srcWithoutScheme = srcWithoutScheme.Substring(i + 1).TrimStart('/'); 131 | //If not absolute, add the current file path 132 | if (!Path.IsPathRooted(srcWithoutScheme)) 133 | { 134 | uri = new Uri(@"file:///" + this.FileInfo.FileDirectory + "/" + srcWithoutScheme); 135 | } 136 | 137 | //For SVG images: Convert to Bitmap 138 | string extension = Path.GetExtension(src); 139 | if (extension != null && extension.Equals(".svg", StringComparison.OrdinalIgnoreCase)) 140 | { 141 | ConvertSvgToBitmap(SvgDocument.Open(uri.LocalPath), imageLoadEvent); 142 | } 143 | else 144 | { 145 | //Load uri, 8, 1 146 | imageLoadEvent.Callback((Bitmap)Image.FromFile(uri.LocalPath, true)); 147 | } 148 | } 149 | catch { } //Not able to handle, refer back to orginal process 150 | } 151 | 152 | /// 153 | /// 154 | /// 155 | /// 156 | /// 157 | protected Bitmap ConvertSvgToBitmap(SvgDocument svgDocument, HtmlImageLoadEventArgs imageLoadEvent) 158 | { 159 | Bitmap svgImage = new Bitmap((int)svgDocument.Width, (int)svgDocument.Height, PixelFormat.Format32bppArgb); 160 | svgDocument.Draw(svgImage); 161 | imageLoadEvent.Callback(svgImage); 162 | imageLoadEvent.Handled = true; 163 | return svgImage; 164 | } 165 | 166 | /// 167 | /// 168 | /// 169 | /// 170 | /// 171 | protected void OnDownloadDataCompleted(DownloadDataCompletedEventArgs downloadEvent, HtmlImageLoadEventArgs imageLoadEvent) 172 | { 173 | using (MemoryStream stream = new MemoryStream(downloadEvent.Result)) 174 | { 175 | ConvertSvgToBitmap(SvgDocument.Open(stream), imageLoadEvent); 176 | } 177 | } 178 | 179 | /// 180 | /// Release the custom loader 181 | /// 182 | protected override void Dispose(bool disposing) 183 | { 184 | if (this.markdownViewerHtmlPanel != null) 185 | { 186 | this.markdownViewerHtmlPanel.ImageLoad -= OnImageLoad; 187 | } 188 | base.Dispose(disposing); 189 | } 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/OptionsPanelGeneral.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 2 | { 3 | partial class OptionsPanelGeneral 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | protected override void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.lblFileExtensions = new System.Windows.Forms.Label(); 33 | this.chkBoxNewFiles = new System.Windows.Forms.CheckBox(); 34 | this.toolTipFileExtensions = new System.Windows.Forms.ToolTip(this.components); 35 | this.grpBoxFiles = new System.Windows.Forms.GroupBox(); 36 | this.txtFileExtensions = new System.Windows.Forms.TextBox(); 37 | this.grpBoxFiles.SuspendLayout(); 38 | this.SuspendLayout(); 39 | // 40 | // lblFileExtensions 41 | // 42 | this.lblFileExtensions.AutoSize = true; 43 | this.lblFileExtensions.Location = new System.Drawing.Point(6, 16); 44 | this.lblFileExtensions.Name = "lblFileExtensions"; 45 | this.lblFileExtensions.Size = new System.Drawing.Size(76, 13); 46 | this.lblFileExtensions.TabIndex = 0; 47 | this.lblFileExtensions.Text = "File extensions"; 48 | // 49 | // chkBoxNewFiles 50 | // 51 | this.chkBoxNewFiles.AutoSize = true; 52 | this.chkBoxNewFiles.Location = new System.Drawing.Point(9, 62); 53 | this.chkBoxNewFiles.Name = "chkBoxNewFiles"; 54 | this.chkBoxNewFiles.Size = new System.Drawing.Size(111, 17); 55 | this.chkBoxNewFiles.TabIndex = 2; 56 | this.chkBoxNewFiles.Text = "Include new files?"; 57 | this.chkBoxNewFiles.UseVisualStyleBackColor = true; 58 | // 59 | // toolTipFileExtensions 60 | // 61 | this.toolTipFileExtensions.AutomaticDelay = 0; 62 | this.toolTipFileExtensions.IsBalloon = true; 63 | this.toolTipFileExtensions.ShowAlways = true; 64 | this.toolTipFileExtensions.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; 65 | this.toolTipFileExtensions.ToolTipTitle = "File extensions"; 66 | // 67 | // grpBoxFiles 68 | // 69 | this.grpBoxFiles.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; 70 | this.grpBoxFiles.Controls.Add(this.lblFileExtensions); 71 | this.grpBoxFiles.Controls.Add(this.chkBoxNewFiles); 72 | this.grpBoxFiles.Controls.Add(this.txtFileExtensions); 73 | this.grpBoxFiles.Dock = System.Windows.Forms.DockStyle.Top; 74 | this.grpBoxFiles.Location = new System.Drawing.Point(0, 0); 75 | this.grpBoxFiles.Name = "grpBoxFiles"; 76 | this.grpBoxFiles.Size = new System.Drawing.Size(1255, 86); 77 | this.grpBoxFiles.TabIndex = 3; 78 | this.grpBoxFiles.TabStop = false; 79 | this.grpBoxFiles.Text = "Files"; 80 | // 81 | // txtFileExtensions 82 | // 83 | this.txtFileExtensions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 84 | | System.Windows.Forms.AnchorStyles.Right))); 85 | this.txtFileExtensions.Location = new System.Drawing.Point(9, 36); 86 | this.txtFileExtensions.Name = "txtFileExtensions"; 87 | this.txtFileExtensions.Size = new System.Drawing.Size(1240, 20); 88 | this.txtFileExtensions.TabIndex = 1; 89 | // 90 | // OptionsPanelGeneral 91 | // 92 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 93 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 94 | this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; 95 | this.Controls.Add(this.grpBoxFiles); 96 | this.Name = "OptionsPanelGeneral"; 97 | this.Size = new System.Drawing.Size(1255, 626); 98 | this.grpBoxFiles.ResumeLayout(false); 99 | this.grpBoxFiles.PerformLayout(); 100 | this.ResumeLayout(false); 101 | 102 | } 103 | 104 | #endregion 105 | 106 | private System.Windows.Forms.Label lblFileExtensions; 107 | private System.Windows.Forms.CheckBox chkBoxNewFiles; 108 | private System.Windows.Forms.ToolTip toolTipFileExtensions; 109 | private System.Windows.Forms.GroupBox grpBoxFiles; 110 | private System.Windows.Forms.TextBox txtFileExtensions; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/OptionsPanelGeneral.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Text.RegularExpressions; 4 | using System.Windows; 5 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewerConfiguration; 6 | 7 | /// 8 | /// 9 | /// 10 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 11 | { 12 | /// 13 | /// 14 | /// 15 | public partial class OptionsPanelGeneral : AbstractOptionsPanel 16 | { 17 | /// 18 | /// 19 | /// 20 | protected string msgFileExtensions = "Add a list of comma-separated file extensions (e.g. \'log,txt,html\'). Empty the box for \'All files\'."; 21 | 22 | /// 23 | /// 24 | /// 25 | protected string regExFileExtensions = "^([a-zA-Z,]*)$"; 26 | 27 | /// 28 | /// 29 | /// 30 | public OptionsPanelGeneral() 31 | { 32 | // 33 | this.txtFileExtensions.Enter += txtFileExtensions_Enter; 34 | this.txtFileExtensions.Leave += txtFileExtensions_Leave; 35 | this.txtFileExtensions.Validating += txtFileExtensions_Validating; 36 | } 37 | 38 | /// 39 | /// Validate that the file extensions field has a correct value 40 | /// 41 | /// 42 | /// 43 | protected void txtFileExtensions_Validating(object sender, CancelEventArgs e) 44 | { 45 | if (!Regex.IsMatch(this.txtFileExtensions.Text, this.regExFileExtensions, RegexOptions.IgnoreCase)) 46 | { 47 | MessageBox.Show(string.Format("Please check \'{0}\'\r\n" + this.msgFileExtensions, this.lblFileExtensions.Text), "Warning!", MessageBoxButton.OK, MessageBoxImage.Error); 48 | e.Cancel = true; 49 | } 50 | else 51 | { 52 | e.Cancel = false; 53 | } 54 | } 55 | 56 | /// 57 | /// 58 | /// 59 | /// 60 | /// 61 | private void txtFileExtensions_Enter(object sender, EventArgs e) 62 | { 63 | this.toolTipFileExtensions.Show(this.msgFileExtensions, this.txtFileExtensions, this.lblFileExtensions.Width, -75); 64 | } 65 | 66 | /// 67 | /// 68 | /// 69 | /// 70 | /// 71 | private void txtFileExtensions_Leave(object sender, EventArgs e) 72 | { 73 | this.toolTipFileExtensions.Hide(this.txtFileExtensions); 74 | 75 | } 76 | 77 | /// 78 | /// 79 | /// 80 | public override void SaveOptions(ref Options options) 81 | { 82 | options.inclNewFiles = this.chkBoxNewFiles.Checked; 83 | options.fileExtensions = this.txtFileExtensions.Text; 84 | } 85 | 86 | /// 87 | /// 88 | /// 89 | public override void LoadOptions(Options options) 90 | { 91 | this.chkBoxNewFiles.Checked = options.inclNewFiles; 92 | this.txtFileExtensions.Text = options.fileExtensions; 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/OptionsPanelGeneral.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/OptionsPanelHTML.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 2 | { 3 | partial class OptionsPanelHTML 4 | { 5 | /// 6 | /// 7 | /// 8 | private System.Windows.Forms.GroupBox grpStyles; 9 | 10 | /// 11 | /// 12 | /// 13 | protected override void InitializeComponent() 14 | { 15 | this.grpStyles = new System.Windows.Forms.GroupBox(); 16 | this.lblCssStyles = new System.Windows.Forms.Label(); 17 | this.txtCssStyles = new System.Windows.Forms.TextBox(); 18 | this.grpHTMLExport = new System.Windows.Forms.GroupBox(); 19 | this.chkOpenHTMLExport = new System.Windows.Forms.CheckBox(); 20 | this.grpStyles.SuspendLayout(); 21 | this.grpHTMLExport.SuspendLayout(); 22 | this.SuspendLayout(); 23 | // 24 | // grpStyles 25 | // 26 | this.grpStyles.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; 27 | this.grpStyles.Controls.Add(this.lblCssStyles); 28 | this.grpStyles.Controls.Add(this.txtCssStyles); 29 | this.grpStyles.Dock = System.Windows.Forms.DockStyle.Top; 30 | this.grpStyles.Location = new System.Drawing.Point(0, 0); 31 | this.grpStyles.Name = "grpStyles"; 32 | this.grpStyles.Size = new System.Drawing.Size(1255, 169); 33 | this.grpStyles.TabIndex = 0; 34 | this.grpStyles.TabStop = false; 35 | this.grpStyles.Text = "Styles"; 36 | // 37 | // lblCssStyles 38 | // 39 | this.lblCssStyles.AutoSize = true; 40 | this.lblCssStyles.Location = new System.Drawing.Point(7, 20); 41 | this.lblCssStyles.Name = "lblCssStyles"; 42 | this.lblCssStyles.Size = new System.Drawing.Size(66, 13); 43 | this.lblCssStyles.TabIndex = 1; 44 | this.lblCssStyles.Text = "Custom CSS"; 45 | // 46 | // txtCssStyles 47 | // 48 | this.txtCssStyles.AcceptsReturn = true; 49 | this.txtCssStyles.AcceptsTab = true; 50 | this.txtCssStyles.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 51 | | System.Windows.Forms.AnchorStyles.Right))); 52 | this.txtCssStyles.Location = new System.Drawing.Point(10, 39); 53 | this.txtCssStyles.Multiline = true; 54 | this.txtCssStyles.Name = "txtCssStyles"; 55 | this.txtCssStyles.ScrollBars = System.Windows.Forms.ScrollBars.Both; 56 | this.txtCssStyles.Size = new System.Drawing.Size(1239, 124); 57 | this.txtCssStyles.TabIndex = 0; 58 | // 59 | // grpHTMLExport 60 | // 61 | this.grpHTMLExport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; 62 | this.grpHTMLExport.Controls.Add(this.chkOpenHTMLExport); 63 | this.grpHTMLExport.Dock = System.Windows.Forms.DockStyle.Top; 64 | this.grpHTMLExport.Location = new System.Drawing.Point(0, 169); 65 | this.grpHTMLExport.Name = "grpHTMLExport"; 66 | this.grpHTMLExport.Size = new System.Drawing.Size(1255, 50); 67 | this.grpHTMLExport.TabIndex = 1; 68 | this.grpHTMLExport.TabStop = false; 69 | this.grpHTMLExport.Text = "Export"; 70 | // 71 | // chkOpenHTMLExport 72 | // 73 | this.chkOpenHTMLExport.AutoSize = true; 74 | this.chkOpenHTMLExport.Location = new System.Drawing.Point(10, 20); 75 | this.chkOpenHTMLExport.Name = "chkOpenHTMLExport"; 76 | this.chkOpenHTMLExport.Size = new System.Drawing.Size(141, 17); 77 | this.chkOpenHTMLExport.TabIndex = 0; 78 | this.chkOpenHTMLExport.Text = "Open HTML after export"; 79 | this.chkOpenHTMLExport.UseVisualStyleBackColor = true; 80 | // 81 | // OptionsPanelHTML 82 | // 83 | this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; 84 | this.Controls.Add(this.grpHTMLExport); 85 | this.Controls.Add(this.grpStyles); 86 | this.Name = "OptionsPanelHTML"; 87 | this.Size = new System.Drawing.Size(1255, 709); 88 | this.grpStyles.ResumeLayout(false); 89 | this.grpStyles.PerformLayout(); 90 | this.grpHTMLExport.ResumeLayout(false); 91 | this.grpHTMLExport.PerformLayout(); 92 | this.ResumeLayout(false); 93 | 94 | } 95 | 96 | private System.Windows.Forms.Label lblCssStyles; 97 | private System.Windows.Forms.TextBox txtCssStyles; 98 | private System.Windows.Forms.GroupBox grpHTMLExport; 99 | private System.Windows.Forms.CheckBox chkOpenHTMLExport; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/OptionsPanelHTML.cs: -------------------------------------------------------------------------------- 1 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewerConfiguration; 2 | /// 3 | /// 4 | /// 5 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 6 | { 7 | /// 8 | /// 9 | /// 10 | public partial class OptionsPanelHTML : AbstractOptionsPanel 11 | { 12 | /// 13 | /// 14 | /// 15 | /// 16 | public override void LoadOptions(Options options) 17 | { 18 | this.txtCssStyles.Text = options.HtmlCssStyle; 19 | this.chkOpenHTMLExport.Checked = options.htmlOpenExport; 20 | } 21 | 22 | /// 23 | /// 24 | /// 25 | /// 26 | public override void SaveOptions(ref Options options) 27 | { 28 | options.HtmlCssStyle = this.txtCssStyles.Text; 29 | options.htmlOpenExport = this.chkOpenHTMLExport.Checked; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/OptionsPanelHTML.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/OptionsPanelPDF.cs: -------------------------------------------------------------------------------- 1 | using PdfSharp; 2 | using System; 3 | using System.Linq; 4 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewerConfiguration; 5 | 6 | /// 7 | /// 8 | /// 9 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 10 | { 11 | /// 12 | /// 13 | /// 14 | public partial class OptionsPanelPDF : AbstractOptionsPanel 15 | { 16 | /// 17 | /// 18 | /// 19 | /// 20 | public override void LoadOptions(Options options) 21 | { 22 | //Load options from enum 23 | this.cmbPDFOrientation.Items.AddRange(Enum.GetNames(typeof(PageOrientation))); 24 | //Set a default value 25 | this.cmbPDFOrientation.SelectedItem = PageOrientation.Portrait.ToString(); 26 | //Now load 27 | this.cmbPDFOrientation.SelectedItem = options.pdfOrientation.ToString(); 28 | // 29 | this.cmbPDFPageSize.Items.AddRange(Enum.GetNames(typeof(PageSize))); 30 | this.cmbPDFPageSize.Items.Remove(PageSize.Undefined.ToString()); 31 | this.cmbPDFPageSize.SelectedItem = PageSize.A4.ToString(); 32 | this.cmbPDFPageSize.SelectedItem = options.pdfPageSize.ToString(); 33 | //Load margins 34 | int[] margins = options.GetMargins(); 35 | this.numMarginLeft.Value = margins[0]; 36 | this.numMarginTop.Value = margins[1]; 37 | this.numMarginRight.Value = margins[2]; 38 | this.numMarginBottom.Value = margins[3]; 39 | // 40 | this.chkOpenPDFExport.Checked = options.pdfOpenExport; 41 | } 42 | 43 | /// 44 | /// 45 | /// 46 | /// 47 | public override void SaveOptions(ref Options options) 48 | { 49 | PageOrientation pdfOrientation; 50 | if (Enum.TryParse(this.cmbPDFOrientation.SelectedItem.ToString(), out pdfOrientation)) 51 | { 52 | options.pdfOrientation = pdfOrientation; 53 | } 54 | PageSize pdfPageSize; 55 | if (Enum.TryParse(this.cmbPDFPageSize.SelectedItem.ToString(), out pdfPageSize)) 56 | { 57 | options.pdfPageSize = pdfPageSize; 58 | } 59 | //Save margins 60 | options.margins = this.numMarginLeft.Value + "," + this.numMarginTop.Value + "," + this.numMarginRight.Value + "," + this.numMarginBottom.Value; 61 | // 62 | options.pdfOpenExport = this.chkOpenPDFExport.Checked; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/OptionsPanelPDF.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Helper/ClipboardHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Helper 8 | { 9 | /// 10 | /// Helper to encode and set HTML fragment to clipboard.
11 | /// See http://theartofdev.com/2014/06/12/setting-htmltext-to-clipboard-revisited/.
12 | /// . 13 | ///
14 | /// 15 | /// The MIT License (MIT) Copyright (c) 2014 Arthur Teplitzki. 16 | /// 17 | public static class ClipboardHelper 18 | { 19 | #region Fields and Consts 20 | 21 | /// 22 | /// The string contains index references to other spots in the string, so we need placeholders so we can compute the offsets.
23 | /// The _ strings are just placeholders. We'll back-patch them actual values afterwards.
24 | /// The string layout () also ensures that it can't appear in the body of the html because the
25 | /// character must be escaped.
26 | ///
27 | private const string Header = @"Version:0.9 28 | StartHTML:<<<<<<<<1 29 | EndHTML:<<<<<<<<2 30 | StartFragment:<<<<<<<<3 31 | EndFragment:<<<<<<<<4 32 | StartSelection:<<<<<<<<3 33 | EndSelection:<<<<<<<<4"; 34 | 35 | /// 36 | /// html comment to point the beginning of html fragment 37 | /// 38 | public const string StartFragment = ""; 39 | 40 | /// 41 | /// html comment to point the end of html fragment 42 | /// 43 | public const string EndFragment = @""; 44 | 45 | /// 46 | /// Used to calculate characters byte count in UTF-8 47 | /// 48 | private static readonly char[] _byteCount = new char[1]; 49 | 50 | #endregion 51 | 52 | 53 | /// 54 | /// Create with given html and plain-text ready to be used for clipboard or drag and drop.
55 | /// Handle missing ]]> tags, specified start\end segments and Unicode characters. 56 | ///
57 | /// 58 | /// 59 | /// Windows Clipboard works with UTF-8 Unicode encoding while .NET strings use with UTF-16 so for clipboard to correctly 60 | /// decode Unicode string added to it from .NET we needs to be re-encoded it using UTF-8 encoding. 61 | /// 62 | /// 63 | /// Builds the CF_HTML header correctly for all possible HTMLs
64 | /// If given html contains start/end fragments then it will use them in the header: 65 | /// hello world]]> 66 | /// If given html contains html/body tags then it will inject start/end fragments to exclude html/body tags: 67 | /// hello world]]> 68 | /// If given html doesn't contain html/body tags then it will inject the tags and start/end fragments properly: 69 | /// world]]> 70 | /// In all cases creating a proper CF_HTML header:
71 | /// 72 | /// 81 | /// hello world 82 | /// ]]> 83 | /// 84 | /// See format specification here: http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/clipboard/htmlclipboard.asp 85 | ///
86 | ///
87 | /// a html fragment 88 | /// the plain text 89 | public static DataObject CreateDataObject(string html, string plainText) 90 | { 91 | html = html ?? String.Empty; 92 | var htmlFragment = GetHtmlDataString(html); 93 | 94 | // re-encode the string so it will work correctly (fixed in CLR 4.0) 95 | if (Environment.Version.Major < 4 && html.Length != Encoding.UTF8.GetByteCount(html)) 96 | htmlFragment = Encoding.Default.GetString(Encoding.UTF8.GetBytes(htmlFragment)); 97 | 98 | var dataObject = new DataObject(); 99 | dataObject.SetData(DataFormats.Html, htmlFragment); 100 | dataObject.SetData(DataFormats.Text, plainText); 101 | dataObject.SetData(DataFormats.UnicodeText, plainText); 102 | return dataObject; 103 | } 104 | 105 | /// 106 | /// Clears clipboard and sets the given HTML and plain text fragment to the clipboard, providing additional meta-information for HTML.
107 | /// See for HTML fragment details.
108 | ///
109 | /// 110 | /// ClipboardHelper.CopyToClipboard("Hello World", "Hello World"); 111 | /// 112 | /// a html fragment 113 | /// the plain text 114 | public static void CopyToClipboard(string html, string plainText) 115 | { 116 | var dataObject = CreateDataObject(html, plainText); 117 | Clipboard.SetDataObject(dataObject); 118 | } 119 | 120 | /// 121 | /// Generate HTML fragment data string with header that is required for the clipboard. 122 | /// 123 | /// the html to generate for 124 | /// the resulted string 125 | private static string GetHtmlDataString(string html) 126 | { 127 | var sb = new StringBuilder(); 128 | sb.AppendLine(Header); 129 | sb.AppendLine(@""); 130 | 131 | // if given html already provided the fragments we won't add them 132 | int fragmentStart, fragmentEnd; 133 | int fragmentStartIdx = html.IndexOf(StartFragment, StringComparison.OrdinalIgnoreCase); 134 | int fragmentEndIdx = html.LastIndexOf(EndFragment, StringComparison.OrdinalIgnoreCase); 135 | 136 | // if html tag is missing add it surrounding the given html (critical) 137 | int htmlOpenIdx = html.IndexOf(" -1 ? html.IndexOf('>', htmlOpenIdx) + 1 : -1; 139 | int htmlCloseIdx = html.LastIndexOf(" -1 ? html.IndexOf('>', bodyOpenIdx) + 1 : -1; 145 | 146 | if (htmlOpenEndIdx < 0 && bodyOpenEndIdx < 0) 147 | { 148 | // the given html doesn't contain html or body tags so we need to add them and place start/end fragments around the given html only 149 | sb.Append(""); 150 | sb.Append(StartFragment); 151 | fragmentStart = GetByteCount(sb); 152 | sb.Append(html); 153 | fragmentEnd = GetByteCount(sb); 154 | sb.Append(EndFragment); 155 | sb.Append(""); 156 | } 157 | else 158 | { 159 | // insert start/end fragments in the proper place (related to html/body tags if exists) so the paste will work correctly 160 | int bodyCloseIdx = html.LastIndexOf(""); 164 | else 165 | sb.Append(html, 0, htmlOpenEndIdx); 166 | 167 | if (bodyOpenEndIdx > -1) 168 | sb.Append(html, htmlOpenEndIdx > -1 ? htmlOpenEndIdx : 0, bodyOpenEndIdx - (htmlOpenEndIdx > -1 ? htmlOpenEndIdx : 0)); 169 | 170 | sb.Append(StartFragment); 171 | fragmentStart = GetByteCount(sb); 172 | 173 | var innerHtmlStart = bodyOpenEndIdx > -1 ? bodyOpenEndIdx : (htmlOpenEndIdx > -1 ? htmlOpenEndIdx : 0); 174 | var innerHtmlEnd = bodyCloseIdx > -1 ? bodyCloseIdx : (htmlCloseIdx > -1 ? htmlCloseIdx : html.Length); 175 | sb.Append(html, innerHtmlStart, innerHtmlEnd - innerHtmlStart); 176 | 177 | fragmentEnd = GetByteCount(sb); 178 | sb.Append(EndFragment); 179 | 180 | if (innerHtmlEnd < html.Length) 181 | sb.Append(html, innerHtmlEnd, html.Length - innerHtmlEnd); 182 | 183 | if (htmlCloseIdx < 0) 184 | sb.Append(""); 185 | } 186 | } 187 | else 188 | { 189 | // handle html with existing start\end fragments just need to calculate the correct bytes offset (surround with html tag if missing) 190 | if (htmlOpenEndIdx < 0) 191 | sb.Append(""); 192 | int start = GetByteCount(sb); 193 | sb.Append(html); 194 | fragmentStart = start + GetByteCount(sb, start, start + fragmentStartIdx) + StartFragment.Length; 195 | fragmentEnd = start + GetByteCount(sb, start, start + fragmentEndIdx); 196 | if (htmlCloseIdx < 0) 197 | sb.Append(""); 198 | } 199 | 200 | // Back-patch offsets (scan only the header part for performance) 201 | sb.Replace("<<<<<<<<1", Header.Length.ToString("D9"), 0, Header.Length); 202 | sb.Replace("<<<<<<<<2", GetByteCount(sb).ToString("D9"), 0, Header.Length); 203 | sb.Replace("<<<<<<<<3", fragmentStart.ToString("D9"), 0, Header.Length); 204 | sb.Replace("<<<<<<<<4", fragmentEnd.ToString("D9"), 0, Header.Length); 205 | 206 | return sb.ToString(); 207 | } 208 | 209 | /// 210 | /// Calculates the number of bytes produced by encoding the string in the string builder in UTF-8 and not .NET default string encoding. 211 | /// 212 | /// the string builder to count its string 213 | /// optional: the start index to calculate from (default - start of string) 214 | /// optional: the end index to calculate to (default - end of string) 215 | /// the number of bytes required to encode the string in UTF-8 216 | private static int GetByteCount(StringBuilder sb, int start = 0, int end = -1) 217 | { 218 | int count = 0; 219 | end = end > -1 ? end : sb.Length; 220 | for (int i = start; i < end; i++) 221 | { 222 | _byteCount[0] = sb[i]; 223 | count += Encoding.UTF8.GetByteCount(_byteCount); 224 | } 225 | return count; 226 | } 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/ILMerge.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | true 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/ILMergeOrder.txt: -------------------------------------------------------------------------------- 1 | # this file contains the partial list of the merged assemblies in the merge order 2 | # you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build 3 | # and finetune merge order to your satisfaction 4 | 5 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Main.cs: -------------------------------------------------------------------------------- 1 | using com.insanitydesign.MarkdownViewerPlusPlus; 2 | using Kbg.NppPluginNET.PluginInfrastructure; 3 | 4 | /// 5 | /// 6 | /// 7 | namespace Kbg.NppPluginNET 8 | { 9 | /// 10 | /// 11 | /// 12 | class Main 13 | { 14 | /// 15 | /// 16 | /// 17 | public const string PluginName = "MarkdownViewer++"; 18 | 19 | /// 20 | /// "Singleton" for this plugin of the actual implementation 21 | /// 22 | private static MarkdownViewer MarkdownViewer = new MarkdownViewer(); 23 | 24 | /// 25 | /// This method is invoked whenever something is happening in notepad++ 26 | /// use eg. as 27 | /// if (notification.Header.Code == (uint)NppMsg.NPPN_xxx) 28 | /// { ... } 29 | /// or 30 | /// 31 | /// if (notification.Header.Code == (uint)SciMsg.SCNxxx) 32 | /// { ... } 33 | /// 34 | /// 35 | public static void OnNotification(ScNotification notification) 36 | { 37 | MarkdownViewer.OnNotification(notification); 38 | } 39 | 40 | /// 41 | /// 42 | /// 43 | internal static void CommandMenuInit() 44 | { 45 | MarkdownViewer.CommandMenuInit(); 46 | } 47 | 48 | /// 49 | /// 50 | /// 51 | internal static void SetToolBarIcon() 52 | { 53 | MarkdownViewer.SetToolBarIcon(); 54 | } 55 | 56 | /// 57 | /// 58 | /// 59 | internal static void PluginCleanUp() 60 | { 61 | MarkdownViewer.PluginCleanUp(); 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/MarkdownViewerConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Kbg.NppPluginNET.PluginInfrastructure; 2 | using PdfSharp; 3 | using System; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Text; 8 | 9 | /// 10 | /// 11 | /// 12 | namespace com.insanitydesign.MarkdownViewerPlusPlus 13 | { 14 | /// 15 | /// 16 | /// 17 | public class MarkdownViewerConfiguration 18 | { 19 | /// 20 | /// 21 | /// 22 | public struct Options 23 | { 24 | /// 25 | /// 26 | /// 27 | public bool synchronizeScrolling; 28 | /// 29 | /// 30 | /// 31 | public string fileExtensions; 32 | /// 33 | /// 34 | /// 35 | public bool inclNewFiles; 36 | /// 37 | /// 38 | /// 39 | private string htmlCssStyle; 40 | /// 41 | /// 42 | /// 43 | public string HtmlCssStyle { 44 | get { 45 | if (htmlCssStyle == null) return ""; 46 | return htmlCssStyle.Replace(@" \n ", Environment.NewLine); 47 | } 48 | set { 49 | htmlCssStyle = value.Replace(Environment.NewLine, @" \n "); 50 | } 51 | } 52 | /// 53 | /// 54 | /// 55 | public PageOrientation pdfOrientation; 56 | /// 57 | /// 58 | /// 59 | public PageSize pdfPageSize; 60 | /// 61 | /// 62 | /// 63 | public string margins; 64 | 65 | /// 66 | /// 67 | /// 68 | /// 69 | public int[] GetMargins() 70 | { 71 | try 72 | { 73 | return this.margins.Split(',').Select(x => int.Parse(x)).ToArray(); 74 | } 75 | catch { } 76 | //Default to 5mm 77 | return new int[] { 5, 5, 5, 5 }; 78 | } 79 | 80 | /// 81 | /// 82 | /// 83 | public bool pdfOpenExport; 84 | 85 | /// 86 | /// 87 | /// 88 | public bool htmlOpenExport; 89 | } 90 | 91 | /// 92 | /// 93 | /// 94 | protected string iniFilePath = null; 95 | 96 | /// 97 | /// 98 | /// 99 | protected string assemblyName = ""; 100 | 101 | /// 102 | /// 103 | /// 104 | public Options options; 105 | 106 | /// 107 | /// 108 | /// 109 | public MarkdownViewerConfiguration() 110 | { 111 | this.assemblyName = Assembly.GetExecutingAssembly().GetName().Name; 112 | Init(); 113 | } 114 | 115 | /// 116 | /// Used for initing and re-initing 117 | /// 118 | public void Init() 119 | { 120 | // 121 | StringBuilder sbIniFilePath = new StringBuilder(Win32.MAX_PATH); 122 | Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETPLUGINSCONFIGDIR, Win32.MAX_PATH, sbIniFilePath); 123 | this.iniFilePath = sbIniFilePath.ToString(); 124 | 125 | // if config path doesn't exist, we create it 126 | if (!Directory.Exists(iniFilePath)) 127 | { 128 | Directory.CreateDirectory(iniFilePath); 129 | } 130 | 131 | // 132 | this.iniFilePath = Path.Combine(iniFilePath, this.assemblyName + ".ini"); 133 | Load(); 134 | } 135 | 136 | /// 137 | /// Load all configuration settings 138 | /// 139 | public void Load() 140 | { 141 | //Grab ini file settings based on struct members 142 | this.options = GetDefaultOptions(); 143 | //Unbox/Box magic to set structs 144 | object options = this.options; 145 | foreach (FieldInfo field in this.options.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) 146 | { 147 | if (field.FieldType == typeof(bool)) 148 | { 149 | field.SetValue(options, (Win32.GetPrivateProfileInt(this.assemblyName, field.Name, 0, iniFilePath) != 0)); 150 | } 151 | else if (field.FieldType == typeof(string)) 152 | { 153 | StringBuilder sbFieldValue = new StringBuilder(32767); 154 | Win32.GetPrivateProfileString(this.assemblyName, field.Name, "", sbFieldValue, 32767, iniFilePath); 155 | field.SetValue(options, sbFieldValue.ToString()); 156 | } 157 | else if (field.FieldType.IsEnum) 158 | { 159 | StringBuilder sbFieldValue = new StringBuilder(Win32.MAX_PATH); 160 | Win32.GetPrivateProfileString(this.assemblyName, field.Name, "", sbFieldValue, Win32.MAX_PATH, iniFilePath); 161 | try 162 | { 163 | field.SetValue(options, Enum.Parse(field.FieldType, sbFieldValue.ToString())); 164 | } 165 | catch { } 166 | } 167 | } 168 | //Unbox/Box magic to set structs 169 | this.options = (Options)options; 170 | } 171 | 172 | /// 173 | /// Save all made changes to the configuration 174 | /// 175 | public void Save() 176 | { 177 | //Save ini file settings based on struct members 178 | foreach (FieldInfo field in this.options.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) 179 | { 180 | var value = field.GetValue(this.options); 181 | value = value != null ? value : ""; 182 | if (field.FieldType == typeof(bool)) 183 | { 184 | Win32.WritePrivateProfileString(this.assemblyName, field.Name, ((bool)value) ? "1" : "0", iniFilePath); 185 | } 186 | else if (field.FieldType == typeof(string) || field.FieldType.IsEnum) 187 | { 188 | Win32.WritePrivateProfileString(this.assemblyName, field.Name, value.ToString(), iniFilePath); 189 | } 190 | } 191 | } 192 | 193 | /// 194 | /// 195 | /// 196 | /// 197 | /// 198 | /// 199 | public bool ValidateFileExtension(string fileExtension, string fileName = "") 200 | { 201 | //Nothing set -> Render all 202 | if (this.options.fileExtensions == null || this.options.fileExtensions == "") return true; 203 | //Something set but nothing given, check for "new " files (dirty dirty ^^) 204 | if (fileExtension == null || fileExtension == "") return this.options.inclNewFiles && fileName.StartsWith("new "); 205 | //Otherwise check 206 | return this.options.fileExtensions.ToLower().Contains(fileExtension.ToLower()); 207 | } 208 | 209 | /// 210 | /// 211 | /// 212 | /// An Options object containing some pre-set default options 213 | protected Options GetDefaultOptions() 214 | { 215 | Options options = new Options() 216 | { 217 | inclNewFiles = true, 218 | pdfOrientation = PageOrientation.Portrait, 219 | pdfPageSize = PageSize.A4, 220 | synchronizeScrolling = false, 221 | margins = "5,5,5,5", 222 | pdfOpenExport = false, 223 | htmlOpenExport = false 224 | }; 225 | return options; 226 | } 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/ClikeStringArray.cs: -------------------------------------------------------------------------------- 1 | // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace Kbg.NppPluginNET.PluginInfrastructure 7 | { 8 | public class ClikeStringArray : IDisposable 9 | { 10 | IntPtr _nativeArray; 11 | List _nativeItems; 12 | bool _disposed = false; 13 | 14 | public ClikeStringArray(int num, int stringCapacity) 15 | { 16 | _nativeArray = Marshal.AllocHGlobal((num + 1) * IntPtr.Size); 17 | _nativeItems = new List(); 18 | for (int i = 0; i < num; i++) 19 | { 20 | IntPtr item = Marshal.AllocHGlobal(stringCapacity); 21 | Marshal.WriteIntPtr((IntPtr)((int)_nativeArray + (i * IntPtr.Size)), item); 22 | _nativeItems.Add(item); 23 | } 24 | Marshal.WriteIntPtr((IntPtr)((int)_nativeArray + (num * IntPtr.Size)), IntPtr.Zero); 25 | } 26 | public ClikeStringArray(List lstStrings) 27 | { 28 | _nativeArray = Marshal.AllocHGlobal((lstStrings.Count + 1) * IntPtr.Size); 29 | _nativeItems = new List(); 30 | for (int i = 0; i < lstStrings.Count; i++) 31 | { 32 | IntPtr item = Marshal.StringToHGlobalUni(lstStrings[i]); 33 | Marshal.WriteIntPtr((IntPtr)((int)_nativeArray + (i * IntPtr.Size)), item); 34 | _nativeItems.Add(item); 35 | } 36 | Marshal.WriteIntPtr((IntPtr)((int)_nativeArray + (lstStrings.Count * IntPtr.Size)), IntPtr.Zero); 37 | } 38 | 39 | public IntPtr NativePointer { get { return _nativeArray; } } 40 | public List ManagedStringsAnsi { get { return _getManagedItems(false); } } 41 | public List ManagedStringsUnicode { get { return _getManagedItems(true); } } 42 | List _getManagedItems(bool unicode) 43 | { 44 | List _managedItems = new List(); 45 | for (int i = 0; i < _nativeItems.Count; i++) 46 | { 47 | if (unicode) _managedItems.Add(Marshal.PtrToStringUni(_nativeItems[i])); 48 | else _managedItems.Add(Marshal.PtrToStringAnsi(_nativeItems[i])); 49 | } 50 | return _managedItems; 51 | } 52 | 53 | public void Dispose() 54 | { 55 | if (!_disposed) 56 | { 57 | for (int i = 0; i < _nativeItems.Count; i++) 58 | if (_nativeItems[i] != IntPtr.Zero) Marshal.FreeHGlobal(_nativeItems[i]); 59 | if (_nativeArray != IntPtr.Zero) Marshal.FreeHGlobal(_nativeArray); 60 | _disposed = true; 61 | } 62 | } 63 | ~ClikeStringArray() 64 | { 65 | Dispose(); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/DllExportAttribute.cs: -------------------------------------------------------------------------------- 1 | // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. 2 | using System; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace NppPlugin.DllExport 6 | { 7 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] 8 | partial class DllExportAttribute : Attribute 9 | { 10 | public DllExportAttribute() 11 | { 12 | } 13 | 14 | public DllExportAttribute(string exportName) 15 | : this(exportName, CallingConvention.StdCall) 16 | { 17 | } 18 | 19 | public DllExportAttribute(string exportName, CallingConvention callingConvention) 20 | { 21 | ExportName = exportName; 22 | CallingConvention = callingConvention; 23 | } 24 | 25 | public CallingConvention CallingConvention { get; set; } 26 | 27 | public string ExportName { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/Mono.Cecil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/Mono.Cecil.dll -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/NppPlugin.DllExport.MSBuild.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/NppPlugin.DllExport.MSBuild.dll -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/NppPlugin.DllExport.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/NppPlugin.DllExport.dll -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/NppPlugin.DllExport.targets: -------------------------------------------------------------------------------- 1 |  3 | 5 | 8 | 9 | 11 | $(DevEnvDir)\..\..\VC\bin 12 | 13 | 28 | 29 | 33 | 38 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/Docking_h.cs: -------------------------------------------------------------------------------- 1 | // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. 2 | // 3 | // This file should stay in sync with the CPP project file 4 | // "notepad-plus-plus/PowerEditor/src/WinControls/DockingWnd/Docking.h" 5 | // found at 6 | // https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/WinControls/DockingWnd/Docking.h 7 | 8 | using System; 9 | using System.Runtime.InteropServices; 10 | 11 | namespace Kbg.NppPluginNET.PluginInfrastructure 12 | { 13 | 14 | [Flags] 15 | public enum NppTbMsg : uint 16 | { 17 | // styles for containers 18 | //CAPTION_TOP = 1, 19 | //CAPTION_BOTTOM = 0, 20 | 21 | // defines for docking manager 22 | CONT_LEFT = 0, 23 | CONT_RIGHT = 1, 24 | CONT_TOP = 2, 25 | CONT_BOTTOM = 3, 26 | DOCKCONT_MAX = 4, 27 | 28 | // mask params for plugins of internal dialogs 29 | DWS_ICONTAB = 0x00000001, // Icon for tabs are available 30 | DWS_ICONBAR = 0x00000002, // Icon for icon bar are available (currently not supported) 31 | DWS_ADDINFO = 0x00000004, // Additional information are in use 32 | DWS_PARAMSALL = (DWS_ICONTAB | DWS_ICONBAR | DWS_ADDINFO), 33 | 34 | // default docking values for first call of plugin 35 | DWS_DF_CONT_LEFT = (CONT_LEFT << 28), // default docking on left 36 | DWS_DF_CONT_RIGHT = (CONT_RIGHT << 28), // default docking on right 37 | DWS_DF_CONT_TOP = (CONT_TOP << 28), // default docking on top 38 | DWS_DF_CONT_BOTTOM = (CONT_BOTTOM << 28), // default docking on bottom 39 | DWS_DF_FLOATING = 0x80000000 // default state is floating 40 | } 41 | 42 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 43 | public struct NppTbData 44 | { 45 | public IntPtr hClient; // HWND: client Window Handle 46 | public string pszName; // TCHAR*: name of plugin (shown in window) 47 | public int dlgID; // int: a funcItem provides the function pointer to start a dialog. Please parse here these ID 48 | // user modifications 49 | public NppTbMsg uMask; // UINT: mask params: look to above defines 50 | public uint hIconTab; // HICON: icon for tabs 51 | public string pszAddInfo; // TCHAR*: for plugin to display additional informations 52 | // internal data, do not use !!! 53 | public RECT rcFloat; // RECT: floating position 54 | public int iPrevCont; // int: stores the privious container (toggling between float and dock) 55 | public string pszModuleName; // const TCHAR*: it's the plugin file name. It's used to identify the plugin 56 | } 57 | 58 | [StructLayout(LayoutKind.Sequential)] 59 | public struct RECT 60 | { 61 | public RECT(int left, int top, int right, int bottom) 62 | { 63 | Left = left; Top = top; Right = right; Bottom = bottom; 64 | } 65 | public int Left; 66 | public int Top; 67 | public int Right; 68 | public int Bottom; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/GatewayDomain.cs: -------------------------------------------------------------------------------- 1 | // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. 2 | using System; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | namespace Kbg.NppPluginNET.PluginInfrastructure 7 | { 8 | /// 9 | /// Colours are set using the RGB format (Red, Green, Blue). The intensity of each colour is set in the range 0 to 255. 10 | /// If you have three such intensities, they are combined as: red | (green << 8) | (blue << 16). 11 | /// If you set all intensities to 255, the colour is white. If you set all intensities to 0, the colour is black. 12 | /// When you set a colour, you are making a request. What you will get depends on the capabilities of the system and the current screen mode. 13 | /// 14 | public class Colour 15 | { 16 | public readonly int Red, Green, Blue; 17 | 18 | public Colour(int rgb) 19 | { 20 | Red = rgb & 0xFF; 21 | Green = (rgb >> 8) & 0xFF; 22 | Blue = (rgb >> 16) & 0xFF; 23 | } 24 | 25 | /// 26 | /// 27 | /// 28 | /// a number 0-255 29 | /// a number 0-255 30 | /// a number 0-255 31 | public Colour(int red, int green, int blue) 32 | { 33 | if(red > 255 || red < 0) 34 | throw new ArgumentOutOfRangeException("red", "must be 0-255"); 35 | if(green > 255 || green < 0) 36 | throw new ArgumentOutOfRangeException("green", "must be 0-255"); 37 | if(blue > 255 || blue < 0) 38 | throw new ArgumentOutOfRangeException("blue", "must be 0-255"); 39 | Red = red; 40 | Green = green; 41 | Blue = blue; 42 | } 43 | 44 | public int Value 45 | { 46 | get { return Red + (Green << 8) + (Blue << 16); } 47 | } 48 | } 49 | 50 | /// 51 | /// Positions within the Scintilla document refer to a character or the gap before that character. 52 | /// The first character in a document is 0, the second 1 and so on. If a document contains nLen characters, the last character is numbered nLen-1. The caret exists between character positions and can be located from before the first character (0) to after the last character (nLen). 53 | /// 54 | /// There are places where the caret can not go where two character bytes make up one character. 55 | /// This occurs when a DBCS character from a language like Japanese is included in the document or when line ends are marked with the CP/M 56 | /// standard of a carriage return followed by a line feed.The INVALID_POSITION constant(-1) represents an invalid position within the document. 57 | /// 58 | /// All lines of text in Scintilla are the same height, and this height is calculated from the largest font in any current style.This restriction 59 | /// is for performance; if lines differed in height then calculations involving positioning of text would require the text to be styled first. 60 | /// 61 | /// If you use messages, there is nothing to stop you setting a position that is in the middle of a CRLF pair, or in the middle of a 2 byte character. 62 | /// However, keyboard commands will not move the caret into such positions. 63 | /// 64 | public class Position : IEquatable 65 | { 66 | private readonly int pos; 67 | 68 | public Position(int pos) 69 | { 70 | this.pos = pos; 71 | } 72 | 73 | public int Value 74 | { 75 | get { return pos; } 76 | } 77 | 78 | public static Position operator +(Position a, Position b) 79 | { 80 | return new Position(a.pos + b.pos); 81 | } 82 | 83 | public static Position operator -(Position a, Position b) 84 | { 85 | return new Position(a.pos - b.pos); 86 | } 87 | 88 | public static bool operator ==(Position a, Position b) 89 | { 90 | if (ReferenceEquals(a, b)) 91 | return true; 92 | if (ReferenceEquals(a, null)) 93 | return false; 94 | if (ReferenceEquals(b, null)) 95 | return false; 96 | return a.pos == b.pos; 97 | } 98 | 99 | public static bool operator !=(Position a, Position b) 100 | { 101 | return !(a == b); 102 | } 103 | 104 | public static bool operator >(Position a, Position b) 105 | { 106 | return a.Value > b.Value; 107 | } 108 | 109 | public static bool operator <(Position a, Position b) 110 | { 111 | return a.Value < b.Value; 112 | } 113 | 114 | public static Position Min(Position a, Position b) 115 | { 116 | if (a < b) 117 | return a; 118 | return b; 119 | } 120 | 121 | public static Position Max(Position a, Position b) 122 | { 123 | if (a > b) 124 | return a; 125 | return b; 126 | } 127 | 128 | public override string ToString() 129 | { 130 | return "Postion: " + pos; 131 | } 132 | 133 | public bool Equals(Position other) 134 | { 135 | if (ReferenceEquals(null, other)) return false; 136 | if (ReferenceEquals(this, other)) return true; 137 | return pos == other.pos; 138 | } 139 | 140 | public override bool Equals(object obj) 141 | { 142 | if (ReferenceEquals(null, obj)) return false; 143 | if (ReferenceEquals(this, obj)) return true; 144 | if (obj.GetType() != this.GetType()) return false; 145 | return Equals((Position)obj); 146 | } 147 | 148 | public override int GetHashCode() 149 | { 150 | return pos; 151 | } 152 | } 153 | 154 | /// 155 | /// Class containing key and modifiers 156 | /// 157 | /// The key code is a visible or control character or a key from the SCK_* enumeration, which contains: 158 | /// SCK_ADD, SCK_BACK, SCK_DELETE, SCK_DIVIDE, SCK_DOWN, SCK_END, SCK_ESCAPE, SCK_HOME, SCK_INSERT, SCK_LEFT, SCK_MENU, SCK_NEXT(Page Down), SCK_PRIOR(Page Up), S 159 | /// CK_RETURN, SCK_RIGHT, SCK_RWIN, SCK_SUBTRACT, SCK_TAB, SCK_UP, and SCK_WIN. 160 | /// 161 | /// The modifiers are a combination of zero or more of SCMOD_ALT, SCMOD_CTRL, SCMOD_SHIFT, SCMOD_META, and SCMOD_SUPER. 162 | /// On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to SCMOD_META.SCMOD_SUPER is only available on GTK+ which is commonly the Windows key. 163 | /// If you are building a table, you might want to use SCMOD_NORM, which has the value 0, to mean no modifiers. 164 | /// 165 | public class KeyModifier 166 | { 167 | private readonly int value; 168 | 169 | /// 170 | /// The key code is a visible or control character or a key from the SCK_* enumeration, which contains: 171 | /// SCK_ADD, SCK_BACK, SCK_DELETE, SCK_DIVIDE, SCK_DOWN, SCK_END, SCK_ESCAPE, SCK_HOME, SCK_INSERT, SCK_LEFT, SCK_MENU, SCK_NEXT(Page Down), SCK_PRIOR(Page Up), 172 | /// SCK_RETURN, SCK_RIGHT, SCK_RWIN, SCK_SUBTRACT, SCK_TAB, SCK_UP, and SCK_WIN. 173 | /// 174 | /// The modifiers are a combination of zero or more of SCMOD_ALT, SCMOD_CTRL, SCMOD_SHIFT, SCMOD_META, and SCMOD_SUPER. 175 | /// On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to SCMOD_META.SCMOD_SUPER is only available on GTK+ which is commonly the Windows key. 176 | /// If you are building a table, you might want to use SCMOD_NORM, which has the value 0, to mean no modifiers. 177 | /// 178 | public KeyModifier(SciMsg SCK_KeyCode, SciMsg SCMOD_modifier) 179 | { 180 | value = (int) SCK_KeyCode | ((int) SCMOD_modifier << 16); 181 | } 182 | 183 | public int Value 184 | { 185 | get { return Value; } 186 | } 187 | } 188 | 189 | [StructLayout(LayoutKind.Sequential)] 190 | public struct CharacterRange 191 | { 192 | public CharacterRange(int cpmin, int cpmax) { cpMin = cpmin; cpMax = cpmax; } 193 | public int cpMin; 194 | public int cpMax; 195 | } 196 | 197 | public class Cells 198 | { 199 | char[] charactersAndStyles; 200 | 201 | public Cells(char[] charactersAndStyles) 202 | { 203 | this.charactersAndStyles = charactersAndStyles; 204 | } 205 | 206 | public char[] Value { get { return charactersAndStyles; } } 207 | } 208 | 209 | public class TextRange : IDisposable 210 | { 211 | Sci_TextRange _sciTextRange; 212 | IntPtr _ptrSciTextRange; 213 | bool _disposed = false; 214 | 215 | public TextRange(CharacterRange chrRange, int stringCapacity) 216 | { 217 | _sciTextRange.chrg = chrRange; 218 | _sciTextRange.lpstrText = Marshal.AllocHGlobal(stringCapacity); 219 | } 220 | public TextRange(int cpmin, int cpmax, int stringCapacity) 221 | { 222 | _sciTextRange.chrg.cpMin = cpmin; 223 | _sciTextRange.chrg.cpMax = cpmax; 224 | _sciTextRange.lpstrText = Marshal.AllocHGlobal(stringCapacity); 225 | } 226 | 227 | [StructLayout(LayoutKind.Sequential)] 228 | struct Sci_TextRange 229 | { 230 | public CharacterRange chrg; 231 | public IntPtr lpstrText; 232 | } 233 | 234 | public IntPtr NativePointer { get { _initNativeStruct(); return _ptrSciTextRange; } } 235 | 236 | public string lpstrText { get { _readNativeStruct(); return Marshal.PtrToStringAnsi(_sciTextRange.lpstrText); } } 237 | 238 | public CharacterRange chrg { get { _readNativeStruct(); return _sciTextRange.chrg; } set { _sciTextRange.chrg = value; _initNativeStruct(); } } 239 | 240 | void _initNativeStruct() 241 | { 242 | if (_ptrSciTextRange == IntPtr.Zero) 243 | _ptrSciTextRange = Marshal.AllocHGlobal(Marshal.SizeOf(_sciTextRange)); 244 | Marshal.StructureToPtr(_sciTextRange, _ptrSciTextRange, false); 245 | } 246 | 247 | void _readNativeStruct() 248 | { 249 | if (_ptrSciTextRange != IntPtr.Zero) 250 | _sciTextRange = (Sci_TextRange)Marshal.PtrToStructure(_ptrSciTextRange, typeof(Sci_TextRange)); 251 | } 252 | 253 | public void Dispose() 254 | { 255 | if (!_disposed) 256 | { 257 | if (_sciTextRange.lpstrText != IntPtr.Zero) Marshal.FreeHGlobal(_sciTextRange.lpstrText); 258 | if (_ptrSciTextRange != IntPtr.Zero) Marshal.FreeHGlobal(_ptrSciTextRange); 259 | _disposed = true; 260 | } 261 | } 262 | 263 | ~TextRange() 264 | { 265 | Dispose(); 266 | } 267 | } 268 | 269 | 270 | /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ 271 | /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ 272 | 273 | } 274 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/NotepadPPGateway.cs: -------------------------------------------------------------------------------- 1 | // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. 2 | using System; 3 | using System.Text; 4 | using NppPluginNET.PluginInfrastructure; 5 | 6 | namespace Kbg.NppPluginNET.PluginInfrastructure 7 | { 8 | public interface INotepadPPGateway 9 | { 10 | void FileNew(); 11 | 12 | string GetCurrentFilePath(); 13 | unsafe string GetFilePath(int bufferId); 14 | void SetCurrentLanguage(LangType language); 15 | /// 16 | /// Returns the response from NPPM_GETFILENAME 17 | /// 18 | /// 19 | string GetCurrentFileName(); 20 | /// 21 | /// Returns the response from NPPM_GETCURRENTDIRECTORY 22 | /// 23 | /// 24 | string GetCurrentDirectory(); 25 | } 26 | 27 | /// 28 | /// This class holds helpers for sending messages defined in the Msgs_h.cs file. It is at the moment 29 | /// incomplete. Please help fill in the blanks. 30 | /// 31 | public class NotepadPPGateway : INotepadPPGateway 32 | { 33 | private const int Unused = 0; 34 | 35 | public void FileNew() 36 | { 37 | Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_MENUCOMMAND, Unused, NppMenuCmd.IDM_FILE_NEW); 38 | } 39 | 40 | /// 41 | /// Returns the response from NPPM_GETCURRENTDIRECTORY 42 | /// 43 | /// 44 | public string GetCurrentDirectory() 45 | { 46 | StringBuilder path = new StringBuilder(Win32.MAX_PATH); 47 | Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETCURRENTDIRECTORY, 0, path); 48 | return path.ToString(); 49 | } 50 | 51 | /// 52 | /// Returns the response from NPPM_GETFILENAME 53 | /// 54 | /// 55 | public string GetCurrentFileName() 56 | { 57 | StringBuilder fileName = new StringBuilder(Win32.MAX_PATH); 58 | Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETFILENAME, 0, fileName); 59 | return fileName.ToString(); 60 | } 61 | 62 | /// 63 | /// Gets the path of the current document. 64 | /// 65 | public string GetCurrentFilePath() 66 | { 67 | var path = new StringBuilder(2000); 68 | Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_GETFULLCURRENTPATH, 0, path); 69 | return path.ToString(); 70 | } 71 | 72 | /// 73 | /// Gets the path of the current document. 74 | /// 75 | public unsafe string GetFilePath(int bufferId) 76 | { 77 | var path = new StringBuilder(2000); 78 | Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_GETFULLPATHFROMBUFFERID, bufferId, path); 79 | return path.ToString(); 80 | } 81 | 82 | public void SetCurrentLanguage(LangType language) 83 | { 84 | Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_SETCURRENTLANGTYPE, Unused, (int) language); 85 | } 86 | } 87 | 88 | /// 89 | /// This class holds helpers for sending messages defined in the Resource_h.cs file. It is at the moment 90 | /// incomplete. Please help fill in the blanks. 91 | /// 92 | class NppResource 93 | { 94 | private const int Unused = 0; 95 | 96 | public void ClearIndicator() 97 | { 98 | Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) Resource.NPPM_INTERNAL_CLEARINDICATOR, Unused, Unused); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/NppPluginNETBase.cs: -------------------------------------------------------------------------------- 1 | // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. 2 | using System; 3 | 4 | namespace Kbg.NppPluginNET.PluginInfrastructure 5 | { 6 | class PluginBase 7 | { 8 | internal static NppData nppData; 9 | internal static FuncItems _funcItems = new FuncItems(); 10 | 11 | internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer) 12 | { 13 | SetCommand(index, commandName, functionPointer, new ShortcutKey(), false); 14 | } 15 | 16 | internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, ShortcutKey shortcut) 17 | { 18 | SetCommand(index, commandName, functionPointer, shortcut, false); 19 | } 20 | 21 | internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, bool checkOnInit) 22 | { 23 | SetCommand(index, commandName, functionPointer, new ShortcutKey(), checkOnInit); 24 | } 25 | 26 | internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, ShortcutKey shortcut, bool checkOnInit) 27 | { 28 | FuncItem funcItem = new FuncItem(); 29 | funcItem._cmdID = index; 30 | funcItem._itemName = commandName; 31 | if (functionPointer != null) 32 | funcItem._pFunc = new NppFuncItemDelegate(functionPointer); 33 | if (shortcut._key != 0) 34 | funcItem._pShKey = shortcut; 35 | funcItem._init2Check = checkOnInit; 36 | _funcItems.Add(funcItem); 37 | } 38 | 39 | internal static IntPtr GetCurrentScintilla() 40 | { 41 | int curScintilla; 42 | Win32.SendMessage(nppData._nppHandle, (uint) NppMsg.NPPM_GETCURRENTSCINTILLA, 0, out curScintilla); 43 | return (curScintilla == 0) ? nppData._scintillaMainHandle : nppData._scintillaSecondHandle; 44 | } 45 | 46 | 47 | static readonly Func gatewayFactory = () => new ScintillaGateway(GetCurrentScintilla()); 48 | 49 | public static Func GetGatewayFactory() 50 | { 51 | return gatewayFactory; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/NppPluginNETHelper.cs: -------------------------------------------------------------------------------- 1 | // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. 2 | using System; 3 | using System.Text; 4 | using System.Windows.Forms; 5 | using System.Collections.Generic; 6 | using System.Runtime.InteropServices; 7 | 8 | namespace Kbg.NppPluginNET.PluginInfrastructure 9 | { 10 | [StructLayout(LayoutKind.Sequential)] 11 | public struct NppData 12 | { 13 | public IntPtr _nppHandle; 14 | public IntPtr _scintillaMainHandle; 15 | public IntPtr _scintillaSecondHandle; 16 | } 17 | 18 | public delegate void NppFuncItemDelegate(); 19 | 20 | [StructLayout(LayoutKind.Sequential)] 21 | public struct ShortcutKey 22 | { 23 | public ShortcutKey(bool isCtrl, bool isAlt, bool isShift, Keys key) 24 | { 25 | // the types 'bool' and 'char' have a size of 1 byte only! 26 | _isCtrl = Convert.ToByte(isCtrl); 27 | _isAlt = Convert.ToByte(isAlt); 28 | _isShift = Convert.ToByte(isShift); 29 | _key = Convert.ToByte(key); 30 | } 31 | public byte _isCtrl; 32 | public byte _isAlt; 33 | public byte _isShift; 34 | public byte _key; 35 | } 36 | 37 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 38 | public struct FuncItem 39 | { 40 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] 41 | public string _itemName; 42 | public NppFuncItemDelegate _pFunc; 43 | public int _cmdID; 44 | public bool _init2Check; 45 | public ShortcutKey _pShKey; 46 | } 47 | 48 | public class FuncItems : IDisposable 49 | { 50 | List _funcItems; 51 | int _sizeFuncItem; 52 | List _shortCutKeys; 53 | IntPtr _nativePointer; 54 | bool _disposed = false; 55 | 56 | public FuncItems() 57 | { 58 | _funcItems = new List(); 59 | _sizeFuncItem = Marshal.SizeOf(typeof(FuncItem)); 60 | _shortCutKeys = new List(); 61 | } 62 | 63 | [DllImport("kernel32")] 64 | static extern void RtlMoveMemory(IntPtr Destination, IntPtr Source, int Length); 65 | public void Add(FuncItem funcItem) 66 | { 67 | int oldSize = _funcItems.Count * _sizeFuncItem; 68 | _funcItems.Add(funcItem); 69 | int newSize = _funcItems.Count * _sizeFuncItem; 70 | IntPtr newPointer = Marshal.AllocHGlobal(newSize); 71 | 72 | if (_nativePointer != IntPtr.Zero) 73 | { 74 | RtlMoveMemory(newPointer, _nativePointer, oldSize); 75 | Marshal.FreeHGlobal(_nativePointer); 76 | } 77 | IntPtr ptrPosNewItem = (IntPtr)(newPointer.ToInt64() + oldSize); 78 | byte[] aB = Encoding.Unicode.GetBytes(funcItem._itemName + "\0"); 79 | Marshal.Copy(aB, 0, ptrPosNewItem, aB.Length); 80 | ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + 128); 81 | IntPtr p = (funcItem._pFunc != null) ? Marshal.GetFunctionPointerForDelegate(funcItem._pFunc) : IntPtr.Zero; 82 | Marshal.WriteIntPtr(ptrPosNewItem, p); 83 | ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + IntPtr.Size); 84 | Marshal.WriteInt32(ptrPosNewItem, funcItem._cmdID); 85 | ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + 4); 86 | Marshal.WriteInt32(ptrPosNewItem, Convert.ToInt32(funcItem._init2Check)); 87 | ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + 4); 88 | if (funcItem._pShKey._key != 0) 89 | { 90 | IntPtr newShortCutKey = Marshal.AllocHGlobal(4); 91 | Marshal.StructureToPtr(funcItem._pShKey, newShortCutKey, false); 92 | Marshal.WriteIntPtr(ptrPosNewItem, newShortCutKey); 93 | } 94 | else Marshal.WriteIntPtr(ptrPosNewItem, IntPtr.Zero); 95 | 96 | _nativePointer = newPointer; 97 | } 98 | 99 | public void RefreshItems() 100 | { 101 | IntPtr ptrPosItem = _nativePointer; 102 | for (int i = 0; i < _funcItems.Count; i++) 103 | { 104 | FuncItem updatedItem = new FuncItem(); 105 | updatedItem._itemName = _funcItems[i]._itemName; 106 | ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + 128); 107 | updatedItem._pFunc = _funcItems[i]._pFunc; 108 | ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + IntPtr.Size); 109 | updatedItem._cmdID = Marshal.ReadInt32(ptrPosItem); 110 | ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + 4); 111 | updatedItem._init2Check = _funcItems[i]._init2Check; 112 | ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + 4); 113 | updatedItem._pShKey = _funcItems[i]._pShKey; 114 | ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + IntPtr.Size); 115 | 116 | _funcItems[i] = updatedItem; 117 | } 118 | } 119 | 120 | public IntPtr NativePointer { get { return _nativePointer; } } 121 | public List Items { get { return _funcItems; } } 122 | 123 | public void Dispose() 124 | { 125 | if (!_disposed) 126 | { 127 | foreach (IntPtr ptr in _shortCutKeys) Marshal.FreeHGlobal(ptr); 128 | if (_nativePointer != IntPtr.Zero) Marshal.FreeHGlobal(_nativePointer); 129 | _disposed = true; 130 | } 131 | } 132 | ~FuncItems() 133 | { 134 | Dispose(); 135 | } 136 | } 137 | 138 | 139 | public enum winVer 140 | { 141 | WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, 142 | WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7, WV_WIN8, WV_WIN81, WV_WIN10 143 | } 144 | 145 | 146 | [Flags] 147 | public enum DockMgrMsg : uint 148 | { 149 | IDB_CLOSE_DOWN = 137, 150 | IDB_CLOSE_UP = 138, 151 | IDD_CONTAINER_DLG = 139, 152 | 153 | IDC_TAB_CONT = 1027, 154 | IDC_CLIENT_TAB = 1028, 155 | IDC_BTN_CAPTION = 1050, 156 | 157 | DMM_MSG = 0x5000, 158 | DMM_CLOSE = (DMM_MSG + 1), 159 | DMM_DOCK = (DMM_MSG + 2), 160 | DMM_FLOAT = (DMM_MSG + 3), 161 | DMM_DOCKALL = (DMM_MSG + 4), 162 | DMM_FLOATALL = (DMM_MSG + 5), 163 | DMM_MOVE = (DMM_MSG + 6), 164 | DMM_UPDATEDISPINFO = (DMM_MSG + 7), 165 | DMM_GETIMAGELIST = (DMM_MSG + 8), 166 | DMM_GETICONPOS = (DMM_MSG + 9), 167 | DMM_DROPDATA = (DMM_MSG + 10), 168 | DMM_MOVE_SPLITTER = (DMM_MSG + 11), 169 | DMM_CANCEL_MOVE = (DMM_MSG + 12), 170 | DMM_LBUTTONUP = (DMM_MSG + 13), 171 | 172 | DMN_FIRST = 1050, 173 | DMN_CLOSE = (DMN_FIRST + 1), 174 | //nmhdr.Code = DWORD(DMN_CLOSE, 0)); 175 | //nmhdr.hwndFrom = hwndNpp; 176 | //nmhdr.IdFrom = ctrlIdNpp; 177 | 178 | DMN_DOCK = (DMN_FIRST + 2), 179 | DMN_FLOAT = (DMN_FIRST + 3) 180 | //nmhdr.Code = DWORD(DMN_XXX, int newContainer); 181 | //nmhdr.hwndFrom = hwndNpp; 182 | //nmhdr.IdFrom = ctrlIdNpp; 183 | } 184 | 185 | [StructLayout(LayoutKind.Sequential)] 186 | public struct toolbarIcons 187 | { 188 | public IntPtr hToolbarBmp; 189 | public IntPtr hToolbarIcon; 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/UnmanagedExports.cs: -------------------------------------------------------------------------------- 1 | // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. 2 | using System; 3 | using System.Runtime.InteropServices; 4 | using Kbg.NppPluginNET.PluginInfrastructure; 5 | using NppPlugin.DllExport; 6 | 7 | namespace Kbg.NppPluginNET 8 | { 9 | class UnmanagedExports 10 | { 11 | [DllExport(CallingConvention=CallingConvention.Cdecl)] 12 | static bool isUnicode() 13 | { 14 | return true; 15 | } 16 | 17 | [DllExport(CallingConvention = CallingConvention.Cdecl)] 18 | static void setInfo(NppData notepadPlusData) 19 | { 20 | PluginBase.nppData = notepadPlusData; 21 | Main.CommandMenuInit(); 22 | } 23 | 24 | [DllExport(CallingConvention = CallingConvention.Cdecl)] 25 | static IntPtr getFuncsArray(ref int nbF) 26 | { 27 | nbF = PluginBase._funcItems.Items.Count; 28 | return PluginBase._funcItems.NativePointer; 29 | } 30 | 31 | [DllExport(CallingConvention = CallingConvention.Cdecl)] 32 | static uint messageProc(uint Message, IntPtr wParam, IntPtr lParam) 33 | { 34 | return 1; 35 | } 36 | 37 | static IntPtr _ptrPluginName = IntPtr.Zero; 38 | [DllExport(CallingConvention = CallingConvention.Cdecl)] 39 | static IntPtr getName() 40 | { 41 | if (_ptrPluginName == IntPtr.Zero) 42 | _ptrPluginName = Marshal.StringToHGlobalUni(Main.PluginName); 43 | return _ptrPluginName; 44 | } 45 | 46 | [DllExport(CallingConvention = CallingConvention.Cdecl)] 47 | static void beNotified(IntPtr notifyCode) 48 | { 49 | ScNotification notification = (ScNotification)Marshal.PtrToStructure(notifyCode, typeof(ScNotification)); 50 | if (notification.Header.Code == (uint)NppMsg.NPPN_TBMODIFICATION) 51 | { 52 | PluginBase._funcItems.RefreshItems(); 53 | Main.SetToolBarIcon(); 54 | } 55 | else if (notification.Header.Code == (uint)NppMsg.NPPN_SHUTDOWN) 56 | { 57 | Main.PluginCleanUp(); 58 | Marshal.FreeHGlobal(_ptrPluginName); 59 | } 60 | else 61 | { 62 | Main.OnNotification(notification); 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MarkdownViewer++")] 9 | [assembly: AssemblyDescription("A Notepad++ Plugin to view a Markdown file rendered on-the-fly")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MarkdownViewer++")] 13 | [assembly: AssemblyCopyright("Copyright © Savas Ziplies 2017-2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("31492674-6fe0-485c-91f0-2e17244588ff")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("0.8.2.*")] 36 | [assembly: AssemblyFileVersion("0.8.2.0")] 37 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("com.insanitydesign.MarkdownViewerPlusPlus.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap Donate_PayPal_green { 67 | get { 68 | object obj = ResourceManager.GetObject("Donate_PayPal_green", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap fa_clipboard_16x16 { 77 | get { 78 | object obj = ResourceManager.GetObject("fa_clipboard_16x16", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Drawing.Bitmap. 85 | /// 86 | internal static System.Drawing.Bitmap fa_cog_16x16 { 87 | get { 88 | object obj = ResourceManager.GetObject("fa_cog_16x16", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Looks up a localized resource of type System.Drawing.Bitmap. 95 | /// 96 | internal static System.Drawing.Bitmap fa_download_16x16 { 97 | get { 98 | object obj = ResourceManager.GetObject("fa_download_16x16", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | 103 | /// 104 | /// Looks up a localized resource of type System.Drawing.Bitmap. 105 | /// 106 | internal static System.Drawing.Bitmap fa_envelope_16x16 { 107 | get { 108 | object obj = ResourceManager.GetObject("fa_envelope_16x16", resourceCulture); 109 | return ((System.Drawing.Bitmap)(obj)); 110 | } 111 | } 112 | 113 | /// 114 | /// Looks up a localized resource of type System.Drawing.Bitmap. 115 | /// 116 | internal static System.Drawing.Bitmap fa_file_pdf_o_16x16 { 117 | get { 118 | object obj = ResourceManager.GetObject("fa_file_pdf_o_16x16", resourceCulture); 119 | return ((System.Drawing.Bitmap)(obj)); 120 | } 121 | } 122 | 123 | /// 124 | /// Looks up a localized resource of type System.Drawing.Bitmap. 125 | /// 126 | internal static System.Drawing.Bitmap fa_html5_16x16 { 127 | get { 128 | object obj = ResourceManager.GetObject("fa_html5_16x16", resourceCulture); 129 | return ((System.Drawing.Bitmap)(obj)); 130 | } 131 | } 132 | 133 | /// 134 | /// Looks up a localized resource of type System.Drawing.Bitmap. 135 | /// 136 | internal static System.Drawing.Bitmap fa_info_16x16 { 137 | get { 138 | object obj = ResourceManager.GetObject("fa_info_16x16", resourceCulture); 139 | return ((System.Drawing.Bitmap)(obj)); 140 | } 141 | } 142 | 143 | /// 144 | /// Looks up a localized resource of type System.Drawing.Bitmap. 145 | /// 146 | internal static System.Drawing.Bitmap fa_paypal_16x16 { 147 | get { 148 | object obj = ResourceManager.GetObject("fa_paypal_16x16", resourceCulture); 149 | return ((System.Drawing.Bitmap)(obj)); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized resource of type System.Drawing.Bitmap. 155 | /// 156 | internal static System.Drawing.Bitmap fa_print_16x16 { 157 | get { 158 | object obj = ResourceManager.GetObject("fa_print_16x16", resourceCulture); 159 | return ((System.Drawing.Bitmap)(obj)); 160 | } 161 | } 162 | 163 | /// 164 | /// Looks up a localized resource of type System.Drawing.Bitmap. 165 | /// 166 | internal static System.Drawing.Bitmap fa_refresh_16x16 { 167 | get { 168 | object obj = ResourceManager.GetObject("fa_refresh_16x16", resourceCulture); 169 | return ((System.Drawing.Bitmap)(obj)); 170 | } 171 | } 172 | 173 | /// 174 | /// Looks up a localized resource of type System.Drawing.Bitmap. 175 | /// 176 | internal static System.Drawing.Bitmap fa_tv_16x16 { 177 | get { 178 | object obj = ResourceManager.GetObject("fa_tv_16x16", resourceCulture); 179 | return ((System.Drawing.Bitmap)(obj)); 180 | } 181 | } 182 | 183 | /// 184 | /// Looks up a localized resource of type System.Drawing.Bitmap. 185 | /// 186 | internal static System.Drawing.Bitmap fa_upload_16x16 { 187 | get { 188 | object obj = ResourceManager.GetObject("fa_upload_16x16", resourceCulture); 189 | return ((System.Drawing.Bitmap)(obj)); 190 | } 191 | } 192 | 193 | /// 194 | /// Looks up a localized resource of type System.Drawing.Bitmap. 195 | /// 196 | internal static System.Drawing.Bitmap markdown_16x16_solid { 197 | get { 198 | object obj = ResourceManager.GetObject("markdown_16x16_solid", resourceCulture); 199 | return ((System.Drawing.Bitmap)(obj)); 200 | } 201 | } 202 | 203 | /// 204 | /// Looks up a localized resource of type System.Drawing.Bitmap. 205 | /// 206 | internal static System.Drawing.Bitmap markdown_16x16_solid_bmp { 207 | get { 208 | object obj = ResourceManager.GetObject("markdown_16x16_solid_bmp", resourceCulture); 209 | return ((System.Drawing.Bitmap)(obj)); 210 | } 211 | } 212 | 213 | /// 214 | /// Looks up a localized string similar to /* Avoid page breaks inside the most common attributes, especially for exports (i.e. PDF) */ 215 | ///td, h1, h2, h3, h4, h5, p, ul, ol, li { 216 | /// page-break-inside: avoid; 217 | ///}. 218 | /// 219 | internal static string MarkdownViewerHTML { 220 | get { 221 | return ResourceManager.GetString("MarkdownViewerHTML", resourceCulture); 222 | } 223 | } 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\fa-download-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | ..\Resources\fa-file-pdf-o-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 126 | 127 | 128 | ..\Resources\fa-html5-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | 131 | ..\Resources\fa-refresh-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 132 | 133 | 134 | ..\Resources\fa-tv-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 135 | 136 | 137 | ..\Resources\MarkdownViewerHTML.css;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 138 | 139 | 140 | ..\Resources\markdown-16x16-solid.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 141 | 142 | 143 | ..\Resources\markdown-16x16-solid.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 144 | 145 | 146 | ..\Resources\fa-envelope-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 147 | 148 | 149 | ..\Resources\fa-print-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 150 | 151 | 152 | ..\Resources\fa-upload-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 153 | 154 | 155 | ..\Resources\fa-clipboard-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 156 | 157 | 158 | ..\Resources\Donate-PayPal-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 159 | 160 | 161 | ..\Resources\fa-cog-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 162 | 163 | 164 | ..\Resources\fa-info-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 165 | 166 | 167 | ..\Resources\fa-paypal-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 168 | 169 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/Donate-PayPal-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/Donate-PayPal-green.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/MarkdownViewerHTML.css: -------------------------------------------------------------------------------- 1 | /* Avoid page breaks inside the most common attributes, especially for exports (i.e. PDF) */ 2 | td, h1, h2, h3, h4, h5, p, ul, ol, li { 3 | page-break-inside: avoid; 4 | } -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/MarkdownViewerPlusPlus-Options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/MarkdownViewerPlusPlus-Options.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/MarkdownViewerPlusPlus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/MarkdownViewerPlusPlus.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-clipboard-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-clipboard-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-cog-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-cog-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-download-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-download-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-envelope-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-envelope-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-file-pdf-o-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-file-pdf-o-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-html5-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-html5-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-info-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-info-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-paypal-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-paypal-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-print-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-print-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-refresh-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-refresh-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-tv-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-tv-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-upload-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/fa-upload-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/markdown-16x16-solid.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/markdown-16x16-solid.bmp -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/markdown-16x16-solid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Resources/markdown-16x16-solid.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Windows/WindowsMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | /// 5 | /// @see https://gist.github.com/amgine/2395987 6 | /// 7 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Windows 8 | { 9 | /// 10 | /// 11 | /// 12 | [StructLayout(LayoutKind.Sequential)] 13 | public struct NMHDR 14 | { 15 | public IntPtr hwndFrom; 16 | public IntPtr idFrom; 17 | public int code; 18 | } 19 | 20 | /// 21 | /// 22 | /// 23 | public enum WindowsMessage 24 | { 25 | WM_NULL = 0x0000, 26 | WM_CREATE = 0x0001, 27 | WM_DESTROY = 0x0002, 28 | WM_MOVE = 0x0003, 29 | WM_SIZE = 0x0005, 30 | WM_ACTIVATE = 0x0006, 31 | WM_SETFOCUS = 0x0007, 32 | WM_KILLFOCUS = 0x0008, 33 | WM_ENABLE = 0x000A, 34 | WM_SETREDRAW = 0x000B, 35 | WM_SETTEXT = 0x000C, 36 | WM_GETTEXT = 0x000D, 37 | WM_GETTEXTLENGTH = 0x000E, 38 | WM_PAINT = 0x000F, 39 | WM_CLOSE = 0x0010, 40 | WM_QUERYENDSESSION = 0x0011, 41 | WM_QUERYOPEN = 0x0013, 42 | WM_ENDSESSION = 0x0016, 43 | WM_QUIT = 0x0012, 44 | WM_ERASEBKGND = 0x0014, 45 | WM_SYSCOLORCHANGE = 0x0015, 46 | WM_SHOWWINDOW = 0x0018, 47 | WM_WININICHANGE = 0x001A, 48 | WM_SETTINGCHANGE = WM_WININICHANGE, 49 | WM_DEVMODECHANGE = 0x001B, 50 | WM_ACTIVATEAPP = 0x001C, 51 | WM_FONTCHANGE = 0x001D, 52 | WM_TIMECHANGE = 0x001E, 53 | WM_CANCELMODE = 0x001F, 54 | WM_SETCURSOR = 0x0020, 55 | WM_MOUSEACTIVATE = 0x0021, 56 | WM_CHILDACTIVATE = 0x0022, 57 | WM_QUEUESYNC = 0x0023, 58 | WM_GETMINMAXINFO = 0x0024, 59 | WM_PAINTICON = 0x0026, 60 | WM_ICONERASEBKGND = 0x0027, 61 | WM_NEXTDLGCTL = 0x0028, 62 | WM_SPOOLERSTATUS = 0x002A, 63 | WM_DRAWITEM = 0x002B, 64 | WM_MEASUREITEM = 0x002C, 65 | WM_DELETEITEM = 0x002D, 66 | WM_VKEYTOITEM = 0x002E, 67 | WM_CHARTOITEM = 0x002F, 68 | WM_SETFONT = 0x0030, 69 | WM_GETFONT = 0x0031, 70 | WM_SETHOTKEY = 0x0032, 71 | WM_GETHOTKEY = 0x0033, 72 | WM_QUERYDRAGICON = 0x0037, 73 | WM_COMPAREITEM = 0x0039, 74 | WM_GETOBJECT = 0x003D, 75 | WM_COMPACTING = 0x0041, 76 | WM_COMMNOTIFY = 0x0044, 77 | WM_WINDOWPOSCHANGING = 0x0046, 78 | WM_WINDOWPOSCHANGED = 0x0047, 79 | WM_POWER = 0x0048, 80 | WM_COPYDATA = 0x004A, 81 | WM_CANCELJOURNAL = 0x004B, 82 | WM_NOTIFY = 0x004E, 83 | WM_INPUTLANGCHANGEREQUEST = 0x0050, 84 | WM_INPUTLANGCHANGE = 0x0051, 85 | WM_TCARD = 0x0052, 86 | WM_HELP = 0x0053, 87 | WM_USERCHANGED = 0x0054, 88 | WM_NOTIFYFORMAT = 0x0055, 89 | WM_CONTEXTMENU = 0x007B, 90 | WM_STYLECHANGING = 0x007C, 91 | WM_STYLECHANGED = 0x007D, 92 | WM_DISPLAYCHANGE = 0x007E, 93 | WM_GETICON = 0x007F, 94 | WM_SETICON = 0x0080, 95 | WM_NCCREATE = 0x0081, 96 | WM_NCDESTROY = 0x0082, 97 | WM_NCCALCSIZE = 0x0083, 98 | WM_NCHITTEST = 0x0084, 99 | WM_NCPAINT = 0x0085, 100 | WM_NCACTIVATE = 0x0086, 101 | WM_GETDLGCODE = 0x0087, 102 | WM_SYNCPAINT = 0x0088, 103 | 104 | 105 | WM_NCMOUSEMOVE = 0x00A0, 106 | WM_NCLBUTTONDOWN = 0x00A1, 107 | WM_NCLBUTTONUP = 0x00A2, 108 | WM_NCLBUTTONDBLCLK = 0x00A3, 109 | WM_NCRBUTTONDOWN = 0x00A4, 110 | WM_NCRBUTTONUP = 0x00A5, 111 | WM_NCRBUTTONDBLCLK = 0x00A6, 112 | WM_NCMBUTTONDOWN = 0x00A7, 113 | WM_NCMBUTTONUP = 0x00A8, 114 | WM_NCMBUTTONDBLCLK = 0x00A9, 115 | WM_NCXBUTTONDOWN = 0x00AB, 116 | WM_NCXBUTTONUP = 0x00AC, 117 | WM_NCXBUTTONDBLCLK = 0x00AD, 118 | 119 | WM_INPUT_DEVICE_CHANGE = 0x00FE, 120 | WM_INPUT = 0x00FF, 121 | 122 | WM_KEYFIRST = 0x0100, 123 | WM_KEYDOWN = 0x0100, 124 | WM_KEYUP = 0x0101, 125 | WM_CHAR = 0x0102, 126 | WM_DEADCHAR = 0x0103, 127 | WM_SYSKEYDOWN = 0x0104, 128 | WM_SYSKEYUP = 0x0105, 129 | WM_SYSCHAR = 0x0106, 130 | WM_SYSDEADCHAR = 0x0107, 131 | WM_UNICHAR = 0x0109, 132 | WM_KEYLAST = 0x0109, 133 | 134 | WM_IME_STARTCOMPOSITION = 0x010D, 135 | WM_IME_ENDCOMPOSITION = 0x010E, 136 | WM_IME_COMPOSITION = 0x010F, 137 | WM_IME_KEYLAST = 0x010F, 138 | 139 | WM_INITDIALOG = 0x0110, 140 | WM_COMMAND = 0x0111, 141 | WM_SYSCOMMAND = 0x0112, 142 | WM_TIMER = 0x0113, 143 | WM_HSCROLL = 0x0114, 144 | WM_VSCROLL = 0x0115, 145 | WM_INITMENU = 0x0116, 146 | WM_INITMENUPOPUP = 0x0117, 147 | WM_MENUSELECT = 0x011F, 148 | WM_MENUCHAR = 0x0120, 149 | WM_ENTERIDLE = 0x0121, 150 | WM_MENURBUTTONUP = 0x0122, 151 | WM_MENUDRAG = 0x0123, 152 | WM_MENUGETOBJECT = 0x0124, 153 | WM_UNINITMENUPOPUP = 0x0125, 154 | WM_MENUCOMMAND = 0x0126, 155 | 156 | WM_CHANGEUISTATE = 0x0127, 157 | WM_UPDATEUISTATE = 0x0128, 158 | WM_QUERYUISTATE = 0x0129, 159 | 160 | WM_CTLCOLORMSGBOX = 0x0132, 161 | WM_CTLCOLOREDIT = 0x0133, 162 | WM_CTLCOLORLISTBOX = 0x0134, 163 | WM_CTLCOLORBTN = 0x0135, 164 | WM_CTLCOLORDLG = 0x0136, 165 | WM_CTLCOLORSCROLLBAR = 0x0137, 166 | WM_CTLCOLORSTATIC = 0x0138, 167 | MN_GETHMENU = 0x01E1, 168 | 169 | WM_MOUSEFIRST = 0x0200, 170 | WM_MOUSEMOVE = 0x0200, 171 | WM_LBUTTONDOWN = 0x0201, 172 | WM_LBUTTONUP = 0x0202, 173 | WM_LBUTTONDBLCLK = 0x0203, 174 | WM_RBUTTONDOWN = 0x0204, 175 | WM_RBUTTONUP = 0x0205, 176 | WM_RBUTTONDBLCLK = 0x0206, 177 | WM_MBUTTONDOWN = 0x0207, 178 | WM_MBUTTONUP = 0x0208, 179 | WM_MBUTTONDBLCLK = 0x0209, 180 | WM_MOUSEWHEEL = 0x020A, 181 | WM_XBUTTONDOWN = 0x020B, 182 | WM_XBUTTONUP = 0x020C, 183 | WM_XBUTTONDBLCLK = 0x020D, 184 | WM_MOUSEHWHEEL = 0x020E, 185 | 186 | WM_PARENTNOTIFY = 0x0210, 187 | WM_ENTERMENULOOP = 0x0211, 188 | WM_EXITMENULOOP = 0x0212, 189 | 190 | WM_NEXTMENU = 0x0213, 191 | WM_SIZING = 0x0214, 192 | WM_CAPTURECHANGED = 0x0215, 193 | WM_MOVING = 0x0216, 194 | 195 | WM_POWERBROADCAST = 0x0218, 196 | 197 | WM_DEVICECHANGE = 0x0219, 198 | 199 | WM_MDICREATE = 0x0220, 200 | WM_MDIDESTROY = 0x0221, 201 | WM_MDIACTIVATE = 0x0222, 202 | WM_MDIRESTORE = 0x0223, 203 | WM_MDINEXT = 0x0224, 204 | WM_MDIMAXIMIZE = 0x0225, 205 | WM_MDITILE = 0x0226, 206 | WM_MDICASCADE = 0x0227, 207 | WM_MDIICONARRANGE = 0x0228, 208 | WM_MDIGETACTIVE = 0x0229, 209 | 210 | 211 | WM_MDISETMENU = 0x0230, 212 | WM_ENTERSIZEMOVE = 0x0231, 213 | WM_EXITSIZEMOVE = 0x0232, 214 | WM_DROPFILES = 0x0233, 215 | WM_MDIREFRESHMENU = 0x0234, 216 | 217 | WM_IME_SETCONTEXT = 0x0281, 218 | WM_IME_NOTIFY = 0x0282, 219 | WM_IME_CONTROL = 0x0283, 220 | WM_IME_COMPOSITIONFULL = 0x0284, 221 | WM_IME_SELECT = 0x0285, 222 | WM_IME_CHAR = 0x0286, 223 | WM_IME_REQUEST = 0x0288, 224 | WM_IME_KEYDOWN = 0x0290, 225 | WM_IME_KEYUP = 0x0291, 226 | 227 | WM_MOUSEHOVER = 0x02A1, 228 | WM_MOUSELEAVE = 0x02A3, 229 | WM_NCMOUSEHOVER = 0x02A0, 230 | WM_NCMOUSELEAVE = 0x02A2, 231 | 232 | WM_WTSSESSION_CHANGE = 0x02B1, 233 | 234 | WM_TABLET_FIRST = 0x02c0, 235 | WM_TABLET_LAST = 0x02df, 236 | 237 | WM_CUT = 0x0300, 238 | WM_COPY = 0x0301, 239 | WM_PASTE = 0x0302, 240 | WM_CLEAR = 0x0303, 241 | WM_UNDO = 0x0304, 242 | WM_RENDERFORMAT = 0x0305, 243 | WM_RENDERALLFORMATS = 0x0306, 244 | WM_DESTROYCLIPBOARD = 0x0307, 245 | WM_DRAWCLIPBOARD = 0x0308, 246 | WM_PAINTCLIPBOARD = 0x0309, 247 | WM_VSCROLLCLIPBOARD = 0x030A, 248 | WM_SIZECLIPBOARD = 0x030B, 249 | WM_ASKCBFORMATNAME = 0x030C, 250 | WM_CHANGECBCHAIN = 0x030D, 251 | WM_HSCROLLCLIPBOARD = 0x030E, 252 | WM_QUERYNEWPALETTE = 0x030F, 253 | WM_PALETTEISCHANGING = 0x0310, 254 | WM_PALETTECHANGED = 0x0311, 255 | WM_HOTKEY = 0x0312, 256 | 257 | WM_PRINT = 0x0317, 258 | WM_PRINTCLIENT = 0x0318, 259 | 260 | WM_APPCOMMAND = 0x0319, 261 | 262 | WM_THEMECHANGED = 0x031A, 263 | 264 | WM_CLIPBOARDUPDATE = 0x031D, 265 | 266 | WM_DWMCOMPOSITIONCHANGED = 0x031E, 267 | WM_DWMNCRENDERINGCHANGED = 0x031F, 268 | WM_DWMCOLORIZATIONCOLORCHANGED = 0x0320, 269 | WM_DWMWINDOWMAXIMIZEDCHANGE = 0x0321, 270 | 271 | WM_GETTITLEBARINFOEX = 0x033F, 272 | 273 | WM_HANDHELDFIRST = 0x0358, 274 | WM_HANDHELDLAST = 0x035F, 275 | 276 | WM_AFXFIRST = 0x0360, 277 | WM_AFXLAST = 0x037F, 278 | 279 | WM_PENWINFIRST = 0x0380, 280 | WM_PENWINLAST = 0x038F, 281 | 282 | WM_APP = 0x8000, 283 | 284 | WM_USER = 0x0400, 285 | 286 | WM_REFLECT = WM_USER + 0x1C00, 287 | } 288 | } 289 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MarkdownViewerPlusPlus [![Build status](https://ci.appveyor.com/api/projects/status/jkuuth039vioms74?svg=true)](https://ci.appveyor.com/project/nea/markdownviewerplusplus) [![GitHub license](https://img.shields.io/github/license/nea/MarkdownViewerPlusPlus.svg)](https://github.com/nea/MarkdownViewerPlusPlus/blob/master/LICENSE.md) [![GitHub (pre-)release](https://img.shields.io/badge/release-0.8.2-yellow.svg)](https://github.com/nea/MarkdownViewerPlusPlus/releases/tag/0.8.2) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/insanitydesign) 2 | A Notepad++ Plugin to view a Markdown file rendered on-the-fly 3 | 4 | ## Features 5 | * Dockable panel (toggle) with a rendered HTML of the currently selected file/tab 6 | * CommonMark compliant ([0.28][4]) 7 | * Synchronized scrolling 8 | * Custom CSS integration 9 | * HTML and PDF Export 10 | * Notepad++ Unicode Plugin 11 | 12 | ## Latest Versions 13 | * 0.8.2 14 | * Merged a lot of bugfixes and improvements, thanks to [monoblaine](https://github.com/monoblaine) 15 | * Updated [Markdig][3] to v0.15.0, [PDFSharp][5] to v1.50.4845-RC2a and [HTMLRenderer][6] accordingly 16 | * Added a shortcut to _Options_ and _About_ to MarkdownViewerPanel 17 | * 0.8.1 18 | * Fixed a bug cutting off text after 10000 characters (#60) 19 | * Changed parsing of custom CSS to recognize _@import_ statements and have them lead (#35) 20 | * 0.8.0 21 | * Changed CommonMark.net converter to [Markdig][3] 22 | * Updated [PDFSharp][5] and [HTMLRenderer][6] accordingly 23 | 24 | Download the latest [release here][9]. For a full version history go [here][10]. 25 | 26 | ## Installation 27 | Download a [release version][9] and copy the included **MarkdownViewerPlusPlus.dll** to the *plugins* sub-folder at your Notepad++ installation directory. The plugin adds a small Markdown icon ![Markdown icon](https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/master/MarkdownViewerPlusPlus/Resources/markdown-16x16-solid.png) to the toolbar to toggle the viewer as dockable panel. 28 | 29 | ### Plugin Manager 30 | If you have the [Plugin Manager][13] installed you can search for MarkdownViewer++ and install it via that plugin. 31 | 32 | ### Compatibility 33 | This plugin requires at least 34 | * Notepad++ 32-bit/64-bit 35 | * Windows 36 | * .NET Framework 4.0 or above 37 | 38 | It has been tested under the following conditions 39 | * Notepad++ 7.5.6 32-bit and 64-bit 40 | * Windows 10 Professional (64-bit) 41 | 42 | ## Usage 43 | To open the MarkdownViewer++ you can 44 | * click the toolbar icon ![Markdown icon](https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/master/MarkdownViewerPlusPlus/Resources/markdown-16x16-solid.png), 45 | * use the shortcut _Ctrl+Shift+M_ 46 | * or open it via the **Plugins** sub-menu 47 | 48 | To synchronize the scrolling between the Notepad++ editor view and the rendered markdown, you can enable the option via the **Plugins** sub-menu. The made selection will be stored and loaded in future sessions. 49 | 50 | ![MarkdownViewer++](https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/master/MarkdownViewerPlusPlus/Resources/MarkdownViewerPlusPlus.png) 51 | 52 | ### Options 53 | The MarkdownViewer++ offers several options to customize your plugin experience. You can open the options dialog via the **Plugins** sub-menu. 54 | 55 | ![MarkdownViewer++ Options](https://raw.githubusercontent.com/nea/MarkdownViewerPlusPlus/master/MarkdownViewerPlusPlus/Resources/MarkdownViewerPlusPlus-Options.png) 56 | 57 | #### General 58 | On the **General** tab you can configure the file extensions the MarkdownViewer++ renderer should actually display. If the box is *empty* all files will be rendered. If you want to limit the rendering to certain file extensions list them in the textbox as comma-separated list without leading dot. 59 | 60 | For example, if you only want to render *txt*, *log* and *md* files just type in "txt,log,md". 61 | 62 | Please note that only file extensions are compared and no certain mime types or anything. If a text document is not named *XYZ.txt* it will not be rendered. 63 | 64 | #### HTML 65 | On the **HTML** tab you can fill in *Custom CSS*, which is used when rendering the MarkdownViewer++ preview as well as the exported HTML. Therefore, you are able to e.g. change bullet-point-list icons or sizes of headlines. The custom CSS textbox is limited to 32767 characters. 66 | 67 | #### PDF 68 | On the **PDF** tab you can set the *orientation* and *page size* of the exported PDF. The content is provided by the [PDFSharp][5] enumerations. 69 | 70 | Additionally, the margins for *top*, *right*, *bottom* and *left* can be set for the exported PDF file. 71 | 72 | ### Highlighting 73 | MarkdownViewer++ adds no markdown highlighting to Notepad++ itself. But you might find the [user-defined syntax highlighting by Edditoria][12] helpful. 74 | 75 | ## License and Credits 76 | The MarkdownViewerPlusPlus is released under the MIT license. 77 | 78 | This Notepad++ plugin integrates the sources of multiple other libraries, because of issues with the library merging process. Credits and thanks to all the developers working on these great projects: 79 | * The plugin is based on the [Notepad++ PluginPack.net][2] by kbilsted provided under the Apache-2.0 license. 80 | * The renderer uses 81 | * [Markdig][3] by lunet-io provided under the BSD-2-Clause license 82 | * [HTMLRenderer.WinForms][6] by ArthurHub provided under the BSD-3-Clause license 83 | * The PDF Exporter uses 84 | * [PDFSharp][5] by empira Software GmbH provided under the MIT license 85 | * [HTMLRenderer.PdfSharp][6] by ArthurHub provided under the BSD-3-Clause license 86 | * The SVG renderer uses [SVG.NET][11] by vvvv provided under the Microsoft Public License 87 | * The menu icons are by [FontAwesome][7] provided under the SIL OFL 1.1 license 88 | * The Markdown icon is by [dcurtis][8] provided under the CC0-1.0 license 89 | 90 | ## Disclaimer 91 | This source and the whole package comes without warranty. It may or may not harm your computer or cell phone. Please use with care. Any damage cannot be related back to the author. The source has been tested on a virtual environment and scanned for viruses and has passed all tests. 92 | 93 | ## Personal Note 94 | *I don't know if this is very useful for a lot of people but I wanted something in private to quickly write and see some formatted Markdown documents. As I was not able to find something similar very quickly I created this project. I hope this proves useful to you... with all its Bugs and Issues ;) If you like it you can give me a shout at [INsanityDesign][1] or let me know via this repository.* 95 | 96 | [1]: http://www.insanitydesign.com/ 97 | [2]: https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net 98 | [3]: https://github.com/lunet-io/markdig 99 | [4]: http://spec.commonmark.org/0.28/ 100 | [5]: http://www.pdfsharp.net/ 101 | [6]: https://htmlrenderer.codeplex.com/ 102 | [7]: http://fontawesome.io/ 103 | [8]: https://github.com/dcurtis/markdown-mark 104 | [9]: https://github.com/nea/MarkdownViewerPlusPlus/releases 105 | [10]: https://github.com/nea/MarkdownViewerPlusPlus/wiki/Version-History 106 | [11]: https://github.com/vvvv/SVG 107 | [12]: https://github.com/Edditoria/markdown-plus-plus 108 | [13]: https://bruderste.in/npp/pm/ 109 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.8.0.{build} 2 | 3 | before_build: 4 | - ps: nuget restore 5 | 6 | platform: 7 | - x86 8 | - x64 9 | 10 | configuration: 11 | - Debug 12 | 13 | build: 14 | parallel: true 15 | verbosity: minimal 16 | -------------------------------------------------------------------------------- /license/HtmlRenderer-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009, José Manuel Menéndez Poo 2 | 3 | Copyright (c) 2013, Arthur Teplitzki 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | Redistributions in binary form must reproduce the above copyright notice, this 14 | list of conditions and the following disclaimer in the documentation and/or 15 | other materials provided with the distribution. 16 | 17 | Neither the name of the menendezpoo.com, ArthurHub nor the names of its 18 | contributors may be used to endorse or promote products derived from 19 | this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /license/Markdig-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Alexandre Mutel 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification 5 | , are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /license/Ms-PL-License.md: -------------------------------------------------------------------------------- 1 | Microsoft Public License (Ms-PL) 2 | 3 | This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. 4 | 5 | 1. Definitions 6 | 7 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. 8 | 9 | A "contribution" is the original software, or any additions or changes to the software. 10 | 11 | A "contributor" is any person that distributes its contribution under this license. 12 | 13 | "Licensed patents" are a contributor's patent claims that read directly on its contribution. 14 | 15 | 2. Grant of Rights 16 | 17 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. 18 | 19 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 20 | 21 | 3. Conditions and Limitations 22 | 23 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. 24 | 25 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. 26 | 27 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. 28 | 29 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. 30 | 31 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. -------------------------------------------------------------------------------- /license/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) , (), 2 | with Reserved Font Name . 3 | Copyright (c) , (), 4 | with Reserved Font Name . 5 | Copyright (c) , (). 6 | 7 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 8 | This license is copied below, and is also available with a FAQ at: 9 | http://scripts.sil.org/OFL 10 | 11 | 12 | ----------------------------------------------------------- 13 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 14 | ----------------------------------------------------------- 15 | 16 | PREAMBLE 17 | The goals of the Open Font License (OFL) are to stimulate worldwide 18 | development of collaborative font projects, to support the font creation 19 | efforts of academic and linguistic communities, and to provide a free and 20 | open framework in which fonts may be shared and improved in partnership 21 | with others. 22 | 23 | The OFL allows the licensed fonts to be used, studied, modified and 24 | redistributed freely as long as they are not sold by themselves. The 25 | fonts, including any derivative works, can be bundled, embedded, 26 | redistributed and/or sold with any software provided that any reserved 27 | names are not used by derivative works. The fonts and derivatives, 28 | however, cannot be released under any other type of license. The 29 | requirement for fonts to remain under this license does not apply 30 | to any document created using the fonts or their derivatives. 31 | 32 | DEFINITIONS 33 | "Font Software" refers to the set of files released by the Copyright 34 | Holder(s) under this license and clearly marked as such. This may 35 | include source files, build scripts and documentation. 36 | 37 | "Reserved Font Name" refers to any names specified as such after the 38 | copyright statement(s). 39 | 40 | "Original Version" refers to the collection of Font Software components as 41 | distributed by the Copyright Holder(s). 42 | 43 | "Modified Version" refers to any derivative made by adding to, deleting, 44 | or substituting -- in part or in whole -- any of the components of the 45 | Original Version, by changing formats or by porting the Font Software to a 46 | new environment. 47 | 48 | "Author" refers to any designer, engineer, programmer, technical 49 | writer or other person who contributed to the Font Software. 50 | 51 | PERMISSION & CONDITIONS 52 | Permission is hereby granted, free of charge, to any person obtaining 53 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 54 | redistribute, and sell modified and unmodified copies of the Font 55 | Software, subject to the following conditions: 56 | 57 | 1) Neither the Font Software nor any of its individual components, 58 | in Original or Modified Versions, may be sold by itself. 59 | 60 | 2) Original or Modified Versions of the Font Software may be bundled, 61 | redistributed and/or sold with any software, provided that each copy 62 | contains the above copyright notice and this license. These can be 63 | included either as stand-alone text files, human-readable headers or 64 | in the appropriate machine-readable metadata fields within text or 65 | binary files as long as those fields can be easily viewed by the user. 66 | 67 | 3) No Modified Version of the Font Software may use the Reserved Font 68 | Name(s) unless explicit written permission is granted by the corresponding 69 | Copyright Holder. This restriction only applies to the primary font name as 70 | presented to the users. 71 | 72 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 73 | Software shall not be used to promote, endorse or advertise any 74 | Modified Version, except to acknowledge the contribution(s) of the 75 | Copyright Holder(s) and the Author(s) or with their explicit written 76 | permission. 77 | 78 | 5) The Font Software, modified or unmodified, in part or in whole, 79 | must be distributed entirely under this license, and must not be 80 | distributed under any other license. The requirement for fonts to 81 | remain under this license does not apply to any document created 82 | using the Font Software. 83 | 84 | TERMINATION 85 | This license becomes null and void if any of the above conditions are 86 | not met. 87 | 88 | DISCLAIMER 89 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 90 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 91 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 92 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 93 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 94 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 95 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 96 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 97 | OTHER DEALINGS IN THE FONT SOFTWARE. 98 | -------------------------------------------------------------------------------- /license/PDFSharp-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2005-2009 empira Software GmbH 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------------------