├── .gitattributes ├── .gitignore ├── .gitmodules ├── Cli ├── App.config ├── Cli.csproj ├── MarkdigExtensions │ └── VisualTaskLists │ │ ├── HtmlVisualTaskListRenderer.cs │ │ └── VisualTaskListExtension.cs ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── LICENSE.md ├── MarkdownViewerPlusPlus.sln ├── MarkdownViewerPlusPlus ├── DebounceDispatcher.cs ├── 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 ├── Helper │ └── ClipboardHelper.cs ├── ILMerge.props ├── ILMergeOrder.txt ├── Main.cs ├── MarkdigExtensions │ └── VisualTaskLists │ │ ├── HtmlVisualTaskListRenderer.cs │ │ └── VisualTaskListExtension.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-download-16x16.png │ ├── fa-envelope-16x16.png │ ├── fa-file-pdf-o-16x16.png │ ├── fa-html5-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 ├── NuGet.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 └── style ├── .gitignore ├── gulpfile.js ├── package.json ├── pnpm-lock.yaml └── sass ├── _extra.scss ├── _variables.scss └── md.scss /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "markdig"] 2 | path = markdig 3 | url = git@github.com:monoblaine/markdig.git 4 | -------------------------------------------------------------------------------- /Cli/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Cli/Cli.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2925EB4C-FD10-493F-9261-03C155B851EE} 8 | Exe 9 | MarkCLI 10 | MarkCLI 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | x86 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\markdig\src\Markdig\bin\Release\net35\Markdig.dll 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Cli/MarkdigExtensions/VisualTaskLists/HtmlVisualTaskListRenderer.cs: -------------------------------------------------------------------------------- 1 | using Markdig.Extensions.TaskLists; 2 | using Markdig.Renderers; 3 | 4 | namespace com.insanitydesign.MarkdownViewerPlusPlus.MarkdigExtensions.VisualTaskLists { 5 | public class HtmlVisualTaskListRenderer : HtmlTaskListRenderer { 6 | protected override void Write (HtmlRenderer renderer, TaskList obj) { 7 | if (renderer.EnableHtmlForInline) { 8 | renderer.Write(""); 21 | } 22 | else { 23 | base.Write(renderer, obj); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Cli/MarkdigExtensions/VisualTaskLists/VisualTaskListExtension.cs: -------------------------------------------------------------------------------- 1 | using Markdig; 2 | using Markdig.Extensions.TaskLists; 3 | using Markdig.Parsers.Inlines; 4 | using Markdig.Renderers; 5 | using Markdig.Renderers.Normalize; 6 | 7 | namespace com.insanitydesign.MarkdownViewerPlusPlus.MarkdigExtensions.VisualTaskLists { 8 | public class VisualTaskListExtension : IMarkdownExtension { 9 | public void Setup (MarkdownPipelineBuilder pipeline) { 10 | if (!pipeline.InlineParsers.Contains()) { 11 | // Insert the parser after the code span parser 12 | pipeline.InlineParsers.InsertBefore(new TaskListInlineParser()); 13 | } 14 | } 15 | 16 | public void Setup (MarkdownPipeline pipeline, IMarkdownRenderer renderer) { 17 | if (renderer is HtmlRenderer htmlRenderer) { 18 | htmlRenderer.ObjectRenderers.AddIfNotAlready(); 19 | } 20 | 21 | if (renderer is NormalizeRenderer normalizeRenderer) { 22 | normalizeRenderer.ObjectRenderers.AddIfNotAlready(); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Cli/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Markdig; 8 | 9 | namespace Cli { 10 | class Program { 11 | private static readonly MarkdownPipeline markdownPipeline = new MarkdownPipelineBuilder() 12 | .UseBootstrap() 13 | .UseAbbreviations() 14 | .UseAutoIdentifiers() 15 | .UseCitations() 16 | .UseCustomContainers() 17 | .UseDefinitionLists() 18 | .UseEmphasisExtras() 19 | .UseFigures() 20 | .UseFooters() 21 | .UseFootnotes() 22 | .UseGridTables() 23 | .UseMathematics() 24 | .UseMediaLinks() 25 | .UsePipeTables() 26 | .UseListExtras() 27 | .Use() 28 | .UseDiagrams() 29 | .UseAutoLinks() 30 | .UseGenericAttributes() 31 | .UseSoftlineBreakAsHardlineBreak() 32 | .Build(); 33 | 34 | public static void Main (String[] args) { 35 | var markdown = File.ReadAllText(args[0], Encoding.UTF8); 36 | var htmlBody = Markdown.ToHtml(markdown, markdownPipeline); 37 | 38 | Console.OutputEncoding = Encoding.UTF8; 39 | Console.WriteLine( 40 | $@" 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | {htmlBody} 51 | 52 | " 53 | ); 54 | } 55 | 56 | private static String _getCSS () => File.ReadAllText( 57 | AppDomain.CurrentDomain.BaseDirectory + "../../../style/md.css", 58 | Encoding.UTF8 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Cli/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("MarkCLI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MarkCLI")] 13 | [assembly: AssemblyCopyright("Copyright © 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("2925eb4c-fd10-493f-9261-03c155b851ee")] 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("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /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 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cli", "Cli\Cli.csproj", "{2925EB4C-FD10-493F-9261-03C155B851EE}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|x64 = Debug|x64 14 | Debug|x86 = Debug|x86 15 | Release|Any CPU = Release|Any CPU 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x64.ActiveCfg = Debug|x64 23 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x64.Build.0 = Debug|x64 24 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x86.ActiveCfg = Debug|x86 25 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x86.Build.0 = Debug|x86 26 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x64.ActiveCfg = Release|x64 29 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x64.Build.0 = Release|x64 30 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x86.ActiveCfg = Release|x86 31 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x86.Build.0 = Release|x86 32 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Debug|x64.ActiveCfg = Debug|Any CPU 35 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Debug|x64.Build.0 = Debug|Any CPU 36 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Debug|x86.ActiveCfg = Debug|Any CPU 37 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Debug|x86.Build.0 = Debug|Any CPU 38 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Release|x64.ActiveCfg = Release|Any CPU 41 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Release|x64.Build.0 = Release|Any CPU 42 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Release|x86.ActiveCfg = Release|Any CPU 43 | {2925EB4C-FD10-493F-9261-03C155B851EE}.Release|x86.Build.0 = Release|Any CPU 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | GlobalSection(ExtensibilityGlobals) = postSolution 49 | SolutionGuid = {5AAE5D73-CE10-405F-B6A7-585D546B1184} 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/DebounceDispatcher.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | /* 3 | ************************************************************** 4 | * Author: Rick Strahl 5 | * � West Wind Technologies, 2017 6 | * http://www.west-wind.com/ 7 | * 8 | * Created: 07/3/2017 9 | * 10 | * The above copyright notice and this permission notice shall be 11 | * included in all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 16 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 17 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 | * OTHER DEALINGS IN THE SOFTWARE. 21 | ************************************************************** 22 | */ 23 | #endregion 24 | 25 | /* 26 | * Source: 27 | * https://github.com/RickStrahl/MarkdownMonster/blob/master/MarkdownMonster/_Classes/Utilities/DebounceDispatcher.cs 28 | */ 29 | 30 | using System; 31 | using System.Windows.Threading; 32 | 33 | namespace MarkdownMonster.Windows { 34 | /// 35 | /// Provides Debounce() and Throttle() methods. 36 | /// Use these methods to ensure that events aren't handled too frequently. 37 | /// 38 | /// Throttle() ensures that events are throttled by the interval specified. 39 | /// Only the last event in the interval sequence of events fires. 40 | /// 41 | /// Debounce() fires an event only after the specified interval has passed 42 | /// in which no other pending event has fired. Only the last event in the 43 | /// sequence is fired. 44 | /// 45 | /// More info: 46 | /// https://weblog.west-wind.com/posts/2017/Jul/02/Debouncing-and-Throttling-Dispatcher-Events 47 | /// 48 | public class DebounceDispatcher { 49 | private DispatcherTimer timer; 50 | private DateTime timerStarted { get; set; } = DateTime.UtcNow.AddYears(-1); 51 | 52 | /// 53 | /// Debounce an event by resetting the event timeout every time the event is 54 | /// fired. The behavior is that the Action passed is fired only after events 55 | /// stop firing for the given timeout period. 56 | /// 57 | /// Use Debounce when you want events to fire only after events stop firing 58 | /// after the given interval timeout period. 59 | /// 60 | /// Wrap the logic you would normally use in your event code into 61 | /// the Action you pass to this method to debounce the event. 62 | /// 63 | /// Timeout in Milliseconds 64 | /// Action to fire when debounced event fires 65 | /// optional parameter 66 | /// optional priorty for the dispatcher 67 | /// optional dispatcher. If not passed or null CurrentDispatcher is used. 68 | public void Debounce (int interval, Action action, 69 | object param = null, 70 | DispatcherPriority priority = DispatcherPriority.ApplicationIdle, 71 | Dispatcher disp = null) { 72 | // kill pending timer and pending ticks 73 | timer?.Stop(); 74 | timer = null; 75 | 76 | if (disp == null) 77 | disp = Dispatcher.CurrentDispatcher; 78 | 79 | // timer is recreated for each event and effectively 80 | // resets the timeout. Action only fires after timeout has fully 81 | // elapsed without other events firing in between 82 | timer = new DispatcherTimer(TimeSpan.FromMilliseconds(interval), priority, (s, e) => { 83 | if (timer == null) 84 | return; 85 | 86 | timer?.Stop(); 87 | timer = null; 88 | action.Invoke(param); 89 | }, disp); 90 | 91 | timer.Start(); 92 | } 93 | 94 | /// 95 | /// This method throttles events by allowing only 1 event to fire for the given 96 | /// timeout period. Only the last event fired is handled - all others are ignored. 97 | /// Throttle will fire events every timeout ms even if additional events are pending. 98 | /// 99 | /// Use Throttle where you need to ensure that events fire at given intervals. 100 | /// 101 | /// Timeout in Milliseconds 102 | /// Action to fire when debounced event fires 103 | /// optional parameter 104 | /// optional priorty for the dispatcher 105 | /// optional dispatcher. If not passed or null CurrentDispatcher is used. 106 | public void Throttle (int interval, Action action, 107 | object param = null, 108 | DispatcherPriority priority = DispatcherPriority.ApplicationIdle, 109 | Dispatcher disp = null) { 110 | // kill pending timer and pending ticks 111 | timer?.Stop(); 112 | timer = null; 113 | 114 | if (disp == null) 115 | disp = Dispatcher.CurrentDispatcher; 116 | 117 | var curTime = DateTime.UtcNow; 118 | 119 | // if timeout is not up yet - adjust timeout to fire 120 | // with potentially new Action parameters 121 | if (curTime.Subtract(timerStarted).TotalMilliseconds < interval) 122 | interval -= (int) curTime.Subtract(timerStarted).TotalMilliseconds; 123 | 124 | timer = new DispatcherTimer(TimeSpan.FromMilliseconds(interval), priority, (s, e) => { 125 | if (timer == null) 126 | return; 127 | 128 | timer?.Stop(); 129 | timer = null; 130 | action.Invoke(param); 131 | }, disp); 132 | 133 | timer.Start(); 134 | timerStarted = curTime; 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /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.Designer.cs: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 5 | { 6 | /// 7 | /// 8 | /// 9 | partial class AbstractRenderer 10 | { 11 | /// 12 | /// Required designer variable. 13 | /// 14 | protected System.ComponentModel.IContainer components = null; 15 | 16 | /// 17 | /// Clean up any resources being used. 18 | /// 19 | /// true if managed resources should be disposed; otherwise, false. 20 | protected override void Dispose(bool disposing) 21 | { 22 | if (disposing && (components != null)) 23 | { 24 | components.Dispose(); 25 | } 26 | base.Dispose(disposing); 27 | } 28 | 29 | #region Windows Form Designer generated code 30 | 31 | /// 32 | /// Required method for Designer support - do not modify 33 | /// the contents of this method with the code editor. 34 | /// 35 | protected void InitializeComponent() 36 | { 37 | this.SuspendLayout(); 38 | // 39 | // AbstractRenderer 40 | // 41 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 42 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 43 | this.Name = "AbstractRenderer"; 44 | this.Text = "MarkdownViewer++"; 45 | this.ResumeLayout(false); 46 | this.PerformLayout(); 47 | 48 | } 49 | 50 | #endregion 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs: -------------------------------------------------------------------------------- 1 | using com.insanitydesign.MarkdownViewerPlusPlus.Properties; 2 | using com.insanitydesign.MarkdownViewerPlusPlus.Windows; 3 | using Kbg.NppPluginNET; 4 | using Kbg.NppPluginNET.PluginInfrastructure; 5 | using System; 6 | using System.Diagnostics; 7 | using System.Drawing; 8 | using System.Drawing.Imaging; 9 | using System.Reflection; 10 | using System.Runtime.InteropServices; 11 | using System.Windows.Forms; 12 | using static com.insanitydesign.MarkdownViewerPlusPlus.Windows.WindowsMessage; 13 | using System.Drawing.Printing; 14 | using System.Xml.Linq; 15 | using System.IO; 16 | using System.Net; 17 | using com.insanitydesign.MarkdownViewerPlusPlus.Helper; 18 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewer; 19 | using Markdig; 20 | using System.Text.RegularExpressions; 21 | using System.Linq; 22 | using System.Collections.Generic; 23 | 24 | /// 25 | /// 26 | /// 27 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 28 | { 29 | /// 30 | /// 31 | /// 32 | public abstract partial class AbstractRenderer : Form 33 | { 34 | /// 35 | /// 36 | /// 37 | protected Icon toolbarIcon; 38 | 39 | /// 40 | /// 41 | /// 42 | protected MarkdownViewer markdownViewer; 43 | 44 | /// 45 | /// 46 | /// 47 | protected string assemblyTitle; 48 | 49 | /// 50 | /// 51 | /// 52 | protected virtual string RawText { get; set; } 53 | 54 | /// 55 | /// 56 | /// 57 | protected virtual string ConvertedText { get; set; } 58 | 59 | /// 60 | /// 61 | /// 62 | protected virtual FileInformation FileInfo { get; set; } 63 | 64 | protected Double LastScrollRatio; 65 | 66 | /// 67 | /// 68 | /// 69 | protected MarkdownPipeline markdownPipeline = new MarkdownPipelineBuilder() 70 | .UseBootstrap() 71 | .UseAbbreviations() 72 | .UseAutoIdentifiers() 73 | .UseCitations() 74 | .UseCustomContainers() 75 | .UseDefinitionLists() 76 | .UseEmphasisExtras() 77 | .UseFigures() 78 | .UseFooters() 79 | .UseFootnotes() 80 | .UseGridTables() 81 | .UseMathematics() 82 | .UseMediaLinks() 83 | .UsePipeTables() 84 | .UseListExtras() 85 | .Use() 86 | .UseDiagrams() 87 | .UseAutoLinks() 88 | .UseGenericAttributes() 89 | .UseSoftlineBreakAsHardlineBreak() 90 | .Build(); 91 | 92 | /// 93 | /// 94 | /// 95 | protected string patternCSSImportStatements = "(@import\\s.+;)"; 96 | 97 | /// 98 | /// 99 | /// 100 | /// 101 | public AbstractRenderer(MarkdownViewer markdownViewer) 102 | { 103 | this.markdownViewer = markdownViewer; 104 | InitializeComponent(); 105 | Init(); 106 | } 107 | 108 | /// 109 | /// 110 | /// 111 | protected virtual void Init() 112 | { 113 | // 114 | using (Bitmap newBmp = new Bitmap(16, 16)) 115 | { 116 | Graphics g = Graphics.FromImage(newBmp); 117 | ColorMap[] colorMap = new ColorMap[1]; 118 | colorMap[0] = new ColorMap(); 119 | colorMap[0].OldColor = Color.Fuchsia; 120 | colorMap[0].NewColor = Color.FromKnownColor(KnownColor.ButtonFace); 121 | ImageAttributes attr = new ImageAttributes(); 122 | attr.SetRemapTable(colorMap); 123 | g.DrawImage(Resources.markdown_16x16_solid_bmp, new Rectangle(0, 0, 16, 16), 0, 0, 16, 16, GraphicsUnit.Pixel, attr); 124 | toolbarIcon = Icon.FromHandle(newBmp.GetHicon()); 125 | } 126 | //Get the AssemblyTitle 127 | this.assemblyTitle = ((AssemblyTitleAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute), false)).Title; 128 | // 129 | NppTbData _nppTbData = new NppTbData(); 130 | _nppTbData.hClient = this.Handle; 131 | _nppTbData.pszName = this.assemblyTitle; 132 | _nppTbData.dlgID = this.markdownViewer.commandId; 133 | _nppTbData.uMask = NppTbMsg.DWS_DF_CONT_RIGHT | NppTbMsg.DWS_ICONTAB | NppTbMsg.DWS_ICONBAR; 134 | _nppTbData.hIconTab = (uint)toolbarIcon.Handle; 135 | _nppTbData.pszModuleName = Main.PluginName; 136 | IntPtr _ptrNppTbData = Marshal.AllocHGlobal(Marshal.SizeOf(_nppTbData)); 137 | Marshal.StructureToPtr(_nppTbData, _ptrNppTbData, false); 138 | //Register dockable window and hide initially 139 | Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_DMMREGASDCKDLG, 0, _ptrNppTbData); 140 | Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_DMMHIDE, 0, this.Handle); 141 | } 142 | 143 | /// 144 | /// 145 | /// 146 | /// 147 | protected override void WndProc(ref Message m) 148 | { 149 | //Listen for the closing of the dockable panel to toggle the toolbar icon 150 | switch (m.Msg) 151 | { 152 | case (int)WM_NOTIFY: 153 | var notify = (NMHDR)Marshal.PtrToStructure(m.LParam, typeof(NMHDR)); 154 | if (notify.code == (int)DockMgrMsg.DMN_CLOSE) 155 | { 156 | this.markdownViewer.ToggleToolbarIcon(false); 157 | } 158 | break; 159 | } 160 | //Continue the processing, as we only toggle 161 | base.WndProc(ref m); 162 | } 163 | 164 | /// 165 | /// 166 | /// 167 | /// 168 | /// 169 | public virtual void Render(string text, FileInformation fileInfo) 170 | { 171 | FileInfo = fileInfo; 172 | RawText = text; 173 | ConvertedText = Markdown.ToHtml(text, this.markdownPipeline); 174 | } 175 | 176 | /// 177 | /// Scroll the rendered panel vertically based on the given ration 178 | /// taken from Notepad++ 179 | /// 180 | /// 181 | public abstract void ScrollByRatioVertically(double scrollRatio); 182 | 183 | /// 184 | /// 185 | /// 186 | /// 187 | /// 188 | /// 189 | protected string BuildHtml(string html = "", string title = "") 190 | { 191 | // 192 | if (title == "") title = this.assemblyTitle; 193 | // 194 | return $@" 195 | 196 | 197 | 198 | 199 | 200 | {title} 201 | 204 | 205 | 221 | 222 | 223 | {html} 224 | 225 | 226 | "; 227 | } 228 | 229 | /// 230 | /// 231 | /// 232 | /// 233 | protected virtual String getCSS() 234 | { 235 | string cssImportStatements = ""; 236 | 237 | //Get all @import statements from the custom CSS 238 | List matches = Regex.Matches(this.markdownViewer.Options.HtmlCssStyle, this.patternCSSImportStatements).Cast().ToList(); 239 | matches.ForEach(match => match.Captures.Cast().ToList().ForEach(capture => cssImportStatements += capture.Value + Environment.NewLine)); 240 | 241 | //Return a CSS with the @import statements in front, the base MarkdownViewer++ CSS and the rest of the custom CSS from the user 242 | return cssImportStatements + Environment.NewLine + Resources.MarkdownViewerHTML + Environment.NewLine + Regex.Replace(this.markdownViewer.Options.HtmlCssStyle, this.patternCSSImportStatements, "").Trim(); 243 | } 244 | 245 | /// 246 | /// 247 | /// 248 | /// 249 | /// 250 | protected int MilimiterToPoint(int mm) 251 | { 252 | return (int)(mm * 2.834646); 253 | } 254 | } 255 | } 256 | -------------------------------------------------------------------------------- /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 System; 2 | using System.Drawing; 3 | using System.Threading.Tasks; 4 | using System.Windows.Forms; 5 | using Microsoft.Toolkit.Forms.UI.Controls; 6 | 7 | /// 8 | /// 9 | /// 10 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 11 | { 12 | /// 13 | /// 14 | /// 15 | public class MarkdownViewerHtmlPanel : Control 16 | { 17 | private WebView _webView; 18 | private String _text; 19 | 20 | /// 21 | /// 22 | /// 23 | public MarkdownViewerHtmlPanel() 24 | { 25 | BackColor = SystemColors.Window; 26 | DoubleBuffered = true; 27 | SetStyle(ControlStyles.ResizeRedraw, true); 28 | SetStyle(ControlStyles.SupportsTransparentBackColor, true); 29 | 30 | _webView = new WebView { 31 | Dock = DockStyle.Fill, 32 | IsJavaScriptEnabled = true, 33 | CausesValidation = false, 34 | IsIndexedDBEnabled = false, 35 | // When true, Notepad++ won't launch. When false, links and images 36 | // with localhost urls won't work. A workaround is to run the following 37 | // command as an administrator: 38 | // checknetisolation LoopbackExempt -a -n=Microsoft.Win32WebViewHost_cw5n1h2txyewy 39 | IsPrivateNetworkClientServerCapabilityEnabled = false, 40 | IsScriptNotifyAllowed = false, 41 | TabIndex = 0 42 | }; 43 | 44 | Controls.Add(_webView); 45 | 46 | this.AllowDrop = false; 47 | this.Dock = System.Windows.Forms.DockStyle.Fill; 48 | this.Location = new System.Drawing.Point(0, 24); 49 | this.MinimumSize = new System.Drawing.Size(20, 20); 50 | this.Name = "markdownViewerHtmlPanel"; 51 | this.Size = new System.Drawing.Size(284, 237); 52 | this.TabIndex = 0; 53 | } 54 | 55 | /// 56 | /// 57 | /// 58 | public override string Text { 59 | get { return _text; } 60 | set { 61 | _text = value; 62 | 63 | Task.Delay(100).ContinueWith(t => { 64 | if (!IsDisposed && !_webView.IsDisposed && _webView.Visible) { 65 | _webView.NavigateToString(_text); 66 | } 67 | }); 68 | } 69 | } 70 | 71 | /// 72 | /// Scroll by the given ratio, calculated with max and page 73 | /// 74 | /// 75 | public void ScrollByRatioVertically(double scrollRatio) 76 | { 77 | if (!IsDisposed) 78 | { 79 | _webView.InvokeScript("scrollByRatio", scrollRatio.ToString(System.Globalization.CultureInfo.InvariantCulture)); 80 | } 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MarkdownViewerOptions)); 36 | this.btnOptionsSave = new System.Windows.Forms.Button(); 37 | this.btnOptionsCancel = new System.Windows.Forms.Button(); 38 | this.splitOptions = new System.Windows.Forms.SplitContainer(); 39 | this.treeOptions = new System.Windows.Forms.TreeView(); 40 | this.imgOptions = new System.Windows.Forms.ImageList(this.components); 41 | ((System.ComponentModel.ISupportInitialize)(this.splitOptions)).BeginInit(); 42 | this.splitOptions.Panel1.SuspendLayout(); 43 | this.splitOptions.SuspendLayout(); 44 | this.SuspendLayout(); 45 | // 46 | // btnOptionsSave 47 | // 48 | this.btnOptionsSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 49 | this.btnOptionsSave.Location = new System.Drawing.Point(455, 312); 50 | this.btnOptionsSave.Name = "btnOptionsSave"; 51 | this.btnOptionsSave.Size = new System.Drawing.Size(75, 23); 52 | this.btnOptionsSave.TabIndex = 0; 53 | this.btnOptionsSave.Text = "Save"; 54 | this.btnOptionsSave.UseVisualStyleBackColor = true; 55 | this.btnOptionsSave.Click += new System.EventHandler(this.btnOptionsSave_Click); 56 | // 57 | // btnOptionsCancel 58 | // 59 | this.btnOptionsCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 60 | this.btnOptionsCancel.CausesValidation = false; 61 | this.btnOptionsCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 62 | this.btnOptionsCancel.Location = new System.Drawing.Point(374, 312); 63 | this.btnOptionsCancel.Name = "btnOptionsCancel"; 64 | this.btnOptionsCancel.Size = new System.Drawing.Size(75, 23); 65 | this.btnOptionsCancel.TabIndex = 1; 66 | this.btnOptionsCancel.Text = "Cancel"; 67 | this.btnOptionsCancel.UseVisualStyleBackColor = true; 68 | this.btnOptionsCancel.Click += new System.EventHandler(this.btnOptionsCancel_Click); 69 | // 70 | // splitOptions 71 | // 72 | this.splitOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 73 | | System.Windows.Forms.AnchorStyles.Left) 74 | | System.Windows.Forms.AnchorStyles.Right))); 75 | this.splitOptions.Location = new System.Drawing.Point(0, 0); 76 | this.splitOptions.Margin = new System.Windows.Forms.Padding(10); 77 | this.splitOptions.Name = "splitOptions"; 78 | // 79 | // splitOptions.Panel1 80 | // 81 | this.splitOptions.Panel1.Controls.Add(this.treeOptions); 82 | this.splitOptions.Size = new System.Drawing.Size(530, 306); 83 | this.splitOptions.SplitterDistance = 135; 84 | this.splitOptions.TabIndex = 2; 85 | // 86 | // treeOptions 87 | // 88 | this.treeOptions.Dock = System.Windows.Forms.DockStyle.Fill; 89 | this.treeOptions.FullRowSelect = true; 90 | this.treeOptions.HideSelection = false; 91 | this.treeOptions.ImageIndex = 0; 92 | this.treeOptions.ImageList = this.imgOptions; 93 | this.treeOptions.Location = new System.Drawing.Point(0, 0); 94 | this.treeOptions.Name = "treeOptions"; 95 | treeNode1.Checked = true; 96 | treeNode1.Name = "nodeGeneral"; 97 | treeNode1.Tag = "OptionsPanelGeneral"; 98 | treeNode1.Text = "General"; 99 | treeNode2.ImageIndex = 1; 100 | treeNode2.Name = "nodeHTML"; 101 | treeNode2.SelectedImageIndex = 1; 102 | treeNode2.Tag = "OptionsPanelHTML"; 103 | treeNode2.Text = "HTML"; 104 | this.treeOptions.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { 105 | treeNode1, 106 | treeNode2}); 107 | this.treeOptions.SelectedImageIndex = 0; 108 | this.treeOptions.Size = new System.Drawing.Size(135, 306); 109 | this.treeOptions.TabIndex = 0; 110 | // 111 | // imgOptions 112 | // 113 | this.imgOptions.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgOptions.ImageStream"))); 114 | this.imgOptions.TransparentColor = System.Drawing.Color.Transparent; 115 | this.imgOptions.Images.SetKeyName(0, "markdown-16x16-solid.png"); 116 | this.imgOptions.Images.SetKeyName(1, "fa-html5-16x16.png"); 117 | this.imgOptions.Images.SetKeyName(2, "fa-file-pdf-o-16x16.png"); 118 | // 119 | // MarkdownViewerOptions 120 | // 121 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 122 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 123 | this.CancelButton = this.btnOptionsCancel; 124 | this.ClientSize = new System.Drawing.Size(534, 341); 125 | this.Controls.Add(this.splitOptions); 126 | this.Controls.Add(this.btnOptionsCancel); 127 | this.Controls.Add(this.btnOptionsSave); 128 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 129 | this.MaximizeBox = false; 130 | this.MinimizeBox = false; 131 | this.MinimumSize = new System.Drawing.Size(550, 380); 132 | this.Name = "MarkdownViewerOptions"; 133 | this.ShowIcon = false; 134 | this.ShowInTaskbar = false; 135 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 136 | this.Text = "Options - MarkdownViewer++"; 137 | this.splitOptions.Panel1.ResumeLayout(false); 138 | ((System.ComponentModel.ISupportInitialize)(this.splitOptions)).EndInit(); 139 | this.splitOptions.ResumeLayout(false); 140 | this.ResumeLayout(false); 141 | 142 | } 143 | 144 | #endregion 145 | 146 | private System.Windows.Forms.Button btnOptionsSave; 147 | private System.Windows.Forms.Button btnOptionsCancel; 148 | private System.Windows.Forms.SplitContainer splitOptions; 149 | private System.Windows.Forms.TreeView treeOptions; 150 | private System.Windows.Forms.ImageList imgOptions; 151 | } 152 | } -------------------------------------------------------------------------------- /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 System.Drawing; 4 | using System.Drawing.Imaging; 5 | using System.Net; 6 | using System.Threading; 7 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewer; 8 | using MarkdownMonster.Windows; 9 | 10 | /// 11 | /// 12 | /// 13 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms 14 | { 15 | /// 16 | /// 17 | /// 18 | public class MarkdownViewerRenderer : AbstractRenderer 19 | { 20 | /// 21 | /// 22 | /// 23 | public MarkdownViewerHtmlPanel markdownViewerHtmlPanel; 24 | 25 | private readonly DebounceDispatcher _debounceTimer = new DebounceDispatcher(); 26 | 27 | /// 28 | /// 29 | /// 30 | /// 31 | public MarkdownViewerRenderer(MarkdownViewer markdownViewer) : base(markdownViewer) 32 | { 33 | } 34 | 35 | /// 36 | /// 37 | /// 38 | protected override void Init() 39 | { 40 | base.Init(); 41 | // 42 | this.markdownViewerHtmlPanel = new MarkdownViewerHtmlPanel(); 43 | //Add to view 44 | this.Controls.Add(this.markdownViewerHtmlPanel); 45 | this.Controls.SetChildIndex(this.markdownViewerHtmlPanel, 0); 46 | } 47 | 48 | /// 49 | /// 50 | /// 51 | /// 52 | /// 53 | public override void Render(string text, FileInformation fileInfo) 54 | { 55 | base.Render(text, fileInfo); 56 | 57 | _debounceTimer.Debounce( 58 | interval: 1000, 59 | action: _ => this.markdownViewerHtmlPanel.Text = BuildHtml(ConvertedText, fileInfo.FileName) 60 | ); 61 | } 62 | 63 | /// 64 | /// Scroll the rendered panel vertically based on the given ration 65 | /// taken from Notepad++ 66 | /// 67 | /// 68 | public override void ScrollByRatioVertically(double scrollRatio) 69 | { 70 | LastScrollRatio = scrollRatio; 71 | this.markdownViewerHtmlPanel.ScrollByRatioVertically(scrollRatio); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /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.grpStyles.SuspendLayout(); 19 | this.SuspendLayout(); 20 | // 21 | // grpStyles 22 | // 23 | this.grpStyles.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; 24 | this.grpStyles.Controls.Add(this.lblCssStyles); 25 | this.grpStyles.Controls.Add(this.txtCssStyles); 26 | this.grpStyles.Dock = System.Windows.Forms.DockStyle.Top; 27 | this.grpStyles.Location = new System.Drawing.Point(0, 0); 28 | this.grpStyles.Name = "grpStyles"; 29 | this.grpStyles.Size = new System.Drawing.Size(1255, 169); 30 | this.grpStyles.TabIndex = 0; 31 | this.grpStyles.TabStop = false; 32 | this.grpStyles.Text = "Styles"; 33 | // 34 | // lblCssStyles 35 | // 36 | this.lblCssStyles.AutoSize = true; 37 | this.lblCssStyles.Location = new System.Drawing.Point(7, 20); 38 | this.lblCssStyles.Name = "lblCssStyles"; 39 | this.lblCssStyles.Size = new System.Drawing.Size(66, 13); 40 | this.lblCssStyles.TabIndex = 1; 41 | this.lblCssStyles.Text = "Custom CSS"; 42 | // 43 | // txtCssStyles 44 | // 45 | this.txtCssStyles.AcceptsReturn = true; 46 | this.txtCssStyles.AcceptsTab = true; 47 | this.txtCssStyles.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 48 | | System.Windows.Forms.AnchorStyles.Right))); 49 | this.txtCssStyles.Location = new System.Drawing.Point(10, 39); 50 | this.txtCssStyles.Multiline = true; 51 | this.txtCssStyles.Name = "txtCssStyles"; 52 | this.txtCssStyles.ScrollBars = System.Windows.Forms.ScrollBars.Both; 53 | this.txtCssStyles.Size = new System.Drawing.Size(1239, 124); 54 | this.txtCssStyles.TabIndex = 0; 55 | // 56 | // OptionsPanelHTML 57 | // 58 | this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; 59 | this.Controls.Add(this.grpStyles); 60 | this.Name = "OptionsPanelHTML"; 61 | this.Size = new System.Drawing.Size(1255, 709); 62 | this.grpStyles.ResumeLayout(false); 63 | this.grpStyles.PerformLayout(); 64 | this.ResumeLayout(false); 65 | 66 | } 67 | 68 | private System.Windows.Forms.Label lblCssStyles; 69 | private System.Windows.Forms.TextBox txtCssStyles; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /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 | } 20 | 21 | /// 22 | /// 23 | /// 24 | /// 25 | public override void SaveOptions(ref Options options) 26 | { 27 | options.HtmlCssStyle = this.txtCssStyles.Text; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /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/ILMerge.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | true 12 | 13 | 14 | C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.20348.0 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 | v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2 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/MarkdigExtensions/VisualTaskLists/HtmlVisualTaskListRenderer.cs: -------------------------------------------------------------------------------- 1 | using Markdig.Extensions.TaskLists; 2 | using Markdig.Renderers; 3 | 4 | namespace com.insanitydesign.MarkdownViewerPlusPlus.MarkdigExtensions.VisualTaskLists { 5 | public class HtmlVisualTaskListRenderer : HtmlTaskListRenderer { 6 | protected override void Write (HtmlRenderer renderer, TaskList obj) { 7 | if (renderer.EnableHtmlForInline) { 8 | renderer.Write(""); 21 | } 22 | else { 23 | base.Write(renderer, obj); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/MarkdigExtensions/VisualTaskLists/VisualTaskListExtension.cs: -------------------------------------------------------------------------------- 1 | using Markdig; 2 | using Markdig.Extensions.TaskLists; 3 | using Markdig.Parsers.Inlines; 4 | using Markdig.Renderers; 5 | using Markdig.Renderers.Normalize; 6 | 7 | namespace com.insanitydesign.MarkdownViewerPlusPlus.MarkdigExtensions.VisualTaskLists { 8 | public class VisualTaskListExtension : IMarkdownExtension { 9 | public void Setup (MarkdownPipelineBuilder pipeline) { 10 | if (!pipeline.InlineParsers.Contains()) { 11 | // Insert the parser after the code span parser 12 | pipeline.InlineParsers.InsertBefore(new TaskListInlineParser()); 13 | } 14 | } 15 | 16 | public void Setup (MarkdownPipeline pipeline, IMarkdownRenderer renderer) { 17 | if (renderer is HtmlRenderer htmlRenderer) { 18 | htmlRenderer.ObjectRenderers.AddIfNotAlready(); 19 | } 20 | 21 | if (renderer is NormalizeRenderer normalizeRenderer) { 22 | normalizeRenderer.ObjectRenderers.AddIfNotAlready(); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/MarkdownViewerConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Kbg.NppPluginNET.PluginInfrastructure; 2 | using System; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Text; 7 | 8 | /// 9 | /// 10 | /// 11 | namespace com.insanitydesign.MarkdownViewerPlusPlus 12 | { 13 | /// 14 | /// 15 | /// 16 | public class MarkdownViewerConfiguration 17 | { 18 | /// 19 | /// 20 | /// 21 | public struct Options 22 | { 23 | /// 24 | /// 25 | /// 26 | public bool synchronizeScrolling; 27 | /// 28 | /// 29 | /// 30 | public string fileExtensions; 31 | /// 32 | /// 33 | /// 34 | public bool inclNewFiles; 35 | /// 36 | /// 37 | /// 38 | private string htmlCssStyle; 39 | /// 40 | /// 41 | /// 42 | public string HtmlCssStyle { 43 | get { 44 | if (htmlCssStyle == null) return ""; 45 | return htmlCssStyle.Replace(@" \n ", Environment.NewLine); 46 | } 47 | set { 48 | htmlCssStyle = value.Replace(Environment.NewLine, @" \n "); 49 | } 50 | } 51 | } 52 | 53 | /// 54 | /// 55 | /// 56 | protected string iniFilePath = null; 57 | 58 | /// 59 | /// 60 | /// 61 | protected string assemblyName = ""; 62 | 63 | /// 64 | /// 65 | /// 66 | public Options options; 67 | 68 | /// 69 | /// 70 | /// 71 | public MarkdownViewerConfiguration() 72 | { 73 | this.assemblyName = Assembly.GetExecutingAssembly().GetName().Name; 74 | Init(); 75 | } 76 | 77 | /// 78 | /// Used for initing and re-initing 79 | /// 80 | public void Init() 81 | { 82 | // 83 | StringBuilder sbIniFilePath = new StringBuilder(Win32.MAX_PATH); 84 | Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETPLUGINSCONFIGDIR, Win32.MAX_PATH, sbIniFilePath); 85 | this.iniFilePath = sbIniFilePath.ToString(); 86 | 87 | // if config path doesn't exist, we create it 88 | if (!Directory.Exists(iniFilePath)) 89 | { 90 | Directory.CreateDirectory(iniFilePath); 91 | } 92 | 93 | // 94 | this.iniFilePath = Path.Combine(iniFilePath, this.assemblyName + ".ini"); 95 | Load(); 96 | } 97 | 98 | /// 99 | /// Load all configuration settings 100 | /// 101 | public void Load() 102 | { 103 | //Grab ini file settings based on struct members 104 | this.options = GetDefaultOptions(); 105 | //Unbox/Box magic to set structs 106 | object options = this.options; 107 | foreach (FieldInfo field in this.options.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) 108 | { 109 | if (field.FieldType == typeof(bool)) 110 | { 111 | field.SetValue(options, (Win32.GetPrivateProfileInt(this.assemblyName, field.Name, 0, iniFilePath) != 0)); 112 | } 113 | else if (field.FieldType == typeof(string)) 114 | { 115 | StringBuilder sbFieldValue = new StringBuilder(32767); 116 | Win32.GetPrivateProfileString(this.assemblyName, field.Name, "", sbFieldValue, 32767, iniFilePath); 117 | field.SetValue(options, sbFieldValue.ToString()); 118 | } 119 | else if (field.FieldType.IsEnum) 120 | { 121 | StringBuilder sbFieldValue = new StringBuilder(Win32.MAX_PATH); 122 | Win32.GetPrivateProfileString(this.assemblyName, field.Name, "", sbFieldValue, Win32.MAX_PATH, iniFilePath); 123 | try 124 | { 125 | field.SetValue(options, Enum.Parse(field.FieldType, sbFieldValue.ToString())); 126 | } 127 | catch { } 128 | } 129 | } 130 | //Unbox/Box magic to set structs 131 | this.options = (Options)options; 132 | } 133 | 134 | /// 135 | /// Save all made changes to the configuration 136 | /// 137 | public void Save() 138 | { 139 | //Save ini file settings based on struct members 140 | foreach (FieldInfo field in this.options.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) 141 | { 142 | var value = field.GetValue(this.options); 143 | value = value != null ? value : ""; 144 | if (field.FieldType == typeof(bool)) 145 | { 146 | Win32.WritePrivateProfileString(this.assemblyName, field.Name, ((bool)value) ? "1" : "0", iniFilePath); 147 | } 148 | else if (field.FieldType == typeof(string) || field.FieldType.IsEnum) 149 | { 150 | Win32.WritePrivateProfileString(this.assemblyName, field.Name, value.ToString(), iniFilePath); 151 | } 152 | } 153 | } 154 | 155 | /// 156 | /// 157 | /// 158 | /// 159 | /// 160 | /// 161 | public bool ValidateFileExtension(string fileExtension, string fileName = "") 162 | { 163 | //Nothing set -> Render all 164 | if (this.options.fileExtensions == null || this.options.fileExtensions == "") return true; 165 | //Something set but nothing given, check for "new " files (dirty dirty ^^) 166 | if (fileExtension == null || fileExtension == "") return this.options.inclNewFiles && fileName.StartsWith("new "); 167 | //Otherwise check 168 | return this.options.fileExtensions.ToLower().Contains(fileExtension.ToLower()); 169 | } 170 | 171 | /// 172 | /// 173 | /// 174 | /// An Options object containing some pre-set default options 175 | protected Options GetDefaultOptions() 176 | { 177 | Options options = new Options() 178 | { 179 | inclNewFiles = true, 180 | synchronizeScrolling = false 181 | }; 182 | return options; 183 | } 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /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/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/Mono.Cecil.dll -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/NppPlugin.DllExport.MSBuild.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/NppPlugin.DllExport.MSBuild.dll -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/PluginInfrastructure/DllExport/NppPlugin.DllExport.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/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/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.9.0")] 36 | [assembly: AssemblyFileVersion("0.9.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_download_16x16 { 87 | get { 88 | object obj = ResourceManager.GetObject("fa_download_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_envelope_16x16 { 97 | get { 98 | object obj = ResourceManager.GetObject("fa_envelope_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_file_pdf_o_16x16 { 107 | get { 108 | object obj = ResourceManager.GetObject("fa_file_pdf_o_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_html5_16x16 { 117 | get { 118 | object obj = ResourceManager.GetObject("fa_html5_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_print_16x16 { 127 | get { 128 | object obj = ResourceManager.GetObject("fa_print_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_refresh_16x16 { 137 | get { 138 | object obj = ResourceManager.GetObject("fa_refresh_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_tv_16x16 { 147 | get { 148 | object obj = ResourceManager.GetObject("fa_tv_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_upload_16x16 { 157 | get { 158 | object obj = ResourceManager.GetObject("fa_upload_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 markdown_16x16_solid { 167 | get { 168 | object obj = ResourceManager.GetObject("markdown_16x16_solid", 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 markdown_16x16_solid_bmp { 177 | get { 178 | object obj = ResourceManager.GetObject("markdown_16x16_solid_bmp", resourceCulture); 179 | return ((System.Drawing.Bitmap)(obj)); 180 | } 181 | } 182 | 183 | /// 184 | /// Looks up a localized string similar to /* Avoid page breaks inside the most common attributes, especially for exports (i.e. PDF) */ 185 | ///td, h1, h2, h3, h4, h5, p, ul, ol, li { 186 | /// page-break-inside: avoid; 187 | ///}. 188 | /// 189 | internal static string MarkdownViewerHTML { 190 | get { 191 | return ResourceManager.GetString("MarkdownViewerHTML", resourceCulture); 192 | } 193 | } 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/Donate-PayPal-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/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/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/MarkdownViewerPlusPlus-Options.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/MarkdownViewerPlusPlus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/MarkdownViewerPlusPlus.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-clipboard-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/fa-clipboard-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-download-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/fa-download-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-envelope-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/fa-envelope-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-file-pdf-o-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/fa-file-pdf-o-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-html5-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/fa-html5-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-print-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/fa-print-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-refresh-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/fa-refresh-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-tv-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/fa-tv-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/fa-upload-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/fa-upload-16x16.png -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/markdown-16x16-solid.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/MarkdownViewerPlusPlus/Resources/markdown-16x16-solid.bmp -------------------------------------------------------------------------------- /MarkdownViewerPlusPlus/Resources/markdown-16x16-solid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monoblaine/MarkdownViewerPlusPlus/0f4a3b92e6497bc5754001959884cf72b54ae90c/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 | -------------------------------------------------------------------------------- /NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MarkdownViewerPlusPlus [![Build status](https://ci.appveyor.com/api/projects/status/jkuuth039vioms74?svg=true)](https://ci.appveyor.com/project/nea/markdownviewerplusplus) 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.0 14 | * Changed CommonMark.net converter to [Markdig][3] 15 | * Updated [PDFSharp][5] and [HTMLRenderer][6] accordingly 16 | * 0.7.1 17 | * Added handling of local image files 18 | * 0.7.0 19 | * Added a menu action to send content as HTML/Text E-mail (requires *Outlook*) 20 | * Added a menu action to print the rendered content directly 21 | * Added margins configuration for PDF exports 22 | * Added a menu action to copy the rendered content to the clipboard 23 | * Added options to open an exported PDF/HTML after the action completed 24 | 25 | Download the latest [release here][9]. For a full version history go [here][10]. 26 | 27 | ## Installation 28 | 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://github.com/nea/MarkdownViewerPlusPlus/blob/master/MarkdownViewerPlusPlus/Resources/markdown-16x16-solid.png?raw=true) to the toolbar to toggle the viewer as dockable panel. 29 | 30 | ### Plugin Manager 31 | If you have the [Plugin Manager][13] installed you can search for MarkdownViewer++ and install it via that plugin. 32 | 33 | ### Compatibility 34 | This plugin requires at least 35 | * Notepad++ 32-bit/64-bit 36 | * Windows 37 | * .NET Framework 4.0 or above 38 | 39 | It has been tested under the following conditions 40 | * Notepad++ 7.5.4 32-bit and 64-bit 41 | * Windows 10 Professional (64-bit) 42 | 43 | ## Usage 44 | To open the MarkdownViewer++ you can 45 | * click the toolbar icon ![Markdown icon](https://github.com/nea/MarkdownViewerPlusPlus/raw/master/MarkdownViewerPlusPlus/Resources/markdown-16x16-solid.png), 46 | * use the shortcut _Ctrl+Shift+M_ 47 | * or open it via the **Plugins** sub-menu 48 | 49 | 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. 50 | 51 | ![MarkdownViewer++](https://github.com/nea/MarkdownViewerPlusPlus/blob/master/MarkdownViewerPlusPlus/Resources/MarkdownViewerPlusPlus.png?raw=true) 52 | 53 | ### Options 54 | The MarkdownViewer++ offers several options to customize your plugin experience. You can open the options dialog via the **Plugins** sub-menu. 55 | 56 | ![MarkdownViewer++ Options](https://github.com/nea/MarkdownViewerPlusPlus/blob/master/MarkdownViewerPlusPlus/Resources/MarkdownViewerPlusPlus-Options.png?raw=true) 57 | 58 | #### General 59 | 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. 60 | 61 | For example, if you only want to render *txt*, *log* and *md* files just type in "txt,log,md". 62 | 63 | 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. 64 | 65 | #### HTML 66 | 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. 67 | 68 | #### PDF 69 | 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. 70 | 71 | Additionally, the margins for *top*, *right*, *bottom* and *left* can be set for the exported PDF file. 72 | 73 | ### Highlighting 74 | MarkdownViewer++ adds no markdown highlighting to Notepad++ itself. But you might find the [user-defined syntax highlighting by Edditoria][12] helpful. 75 | 76 | ## License and Credits 77 | The MarkdownViewerPlusPlus is released under the MIT license. 78 | 79 | 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: 80 | * The plugin is based on the [Notepad++ PluginPack.net][2] by kbilsted provided under the Apache-2.0 license. 81 | * The renderer uses 82 | * [Markdig][3] by lunet-io provided under the BSD-2-Clause license 83 | * [HTMLRenderer.WinForms][6] by ArthurHub provided under the BSD-3-Clause license 84 | * The PDF Exporter uses 85 | * [PDFSharp][5] by empira Software GmbH provided under the MIT license 86 | * [HTMLRenderer.PdfSharp][6] by ArthurHub provided under the BSD-3-Clause license 87 | * The SVG renderer uses [SVG.NET][11] by vvvv provided under the Microsoft Public License 88 | * The menu icons are by [FontAwesome][7] provided under the SIL OFL 1.1 license 89 | * The Markdown icon is by [dcurtis][8] provided under the CC0-1.0 license 90 | 91 | ## Disclaimer 92 | 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. 93 | 94 | ## Personal Note 95 | *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.* 96 | 97 | [1]: http://www.insanitydesign.com/wp/ 98 | [2]: https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net 99 | [3]: https://github.com/lunet-io/markdig 100 | [4]: http://spec.commonmark.org/0.28/ 101 | [5]: http://www.pdfsharp.net/ 102 | [6]: https://htmlrenderer.codeplex.com/ 103 | [7]: http://fontawesome.io/ 104 | [8]: https://github.com/dcurtis/markdown-mark 105 | [9]: https://github.com/nea/MarkdownViewerPlusPlus/releases 106 | [10]: https://github.com/nea/MarkdownViewerPlusPlus/wiki/Version-History 107 | [11]: https://github.com/vvvv/SVG 108 | [12]: https://github.com/Edditoria/markdown-plus-plus 109 | [13]: https://bruderste.in/npp/pm/ 110 | -------------------------------------------------------------------------------- /_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. -------------------------------------------------------------------------------- /style/.gitignore: -------------------------------------------------------------------------------- 1 | *.bak 2 | *.Cache* 3 | Thumbs.db 4 | node_modules 5 | npm-debug.log 6 | bower_components 7 | md.css 8 | -------------------------------------------------------------------------------- /style/gulpfile.js: -------------------------------------------------------------------------------- 1 | //ş 2 | 'use strict'; 3 | 4 | const gulp = require('gulp'), 5 | del = require('del'), 6 | sass = require('gulp-sass')(require('sass')); 7 | 8 | // # CSS 9 | gulp.task('css.clean', async function () { 10 | return del('./md.css'); 11 | }); 12 | 13 | gulp.task('css.pack', gulp.series('css.clean', async function () { 14 | return gulp.src('./sass/md.scss') 15 | .pipe(sass.sync({ precision: 8, outputStyle: 'compressed' }).on('error', sass.logError)) 16 | .pipe(gulp.dest('./')); 17 | })); 18 | 19 | gulp.task('default', gulp.series('css.pack')); 20 | -------------------------------------------------------------------------------- /style/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "markdownviewerplusplus-styles", 3 | "version": "0.1.0", 4 | "description": "Stylesheet for MarkdownViewer++", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Serhan Apaydın (https://github.com/monoblaine)", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "del": "^6.0.0", 13 | "gulp": "^4.0.2", 14 | "gulp-sass": "^5.0.0", 15 | "sass": "^1.45.1" 16 | }, 17 | "dependencies": { 18 | "abt-sass": "gitlab:FrontEndProjects/sass#v3.13.1", 19 | "bootstrap-sass": "github:monoblaine/bootstrap-sass#v3.6.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /style/sass/_extra.scss: -------------------------------------------------------------------------------- 1 | //ş 2 | body { 3 | padding: $font-size-base / 2 $font-size-base $font-size-base; 4 | -ms-overflow-style: scrollbar; // https://stackoverflow.com/a/19706857/1396155 5 | } 6 | 7 | .task-checkbox { 8 | display: inline-block; 9 | margin-right: 3px; 10 | padding-left: 4px; 11 | padding-right: 4px; 12 | background-color: #ff8a80; 13 | color: #fff; 14 | font-family: 'Segoe MDL2 Assets'; 15 | font-size: ceil($font-size-base * .85); 16 | 17 | del > & { 18 | background-color: #bdbdbd; 19 | } 20 | 21 | &--checked { 22 | background-color: #4caf50; 23 | } 24 | 25 | &-sign--invisible { 26 | visibility: hidden; 27 | } 28 | } 29 | 30 | code { 31 | padding: 1px 5px; 32 | font-size: 95%; 33 | 34 | pre > & { 35 | padding-bottom: 0; 36 | } 37 | } 38 | 39 | pre { 40 | font-size: $font-size-base; 41 | } 42 | -------------------------------------------------------------------------------- /style/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | //ş 2 | $brand-primary: darken(#428bca, 6.5%); // $brand-bsprimary; 3 | $body-bg: #fff; 4 | $headings-font-weight: 700; 5 | $headings-color: #921407; 6 | $font-size-base: 14px; 7 | $font-family-monospace: 'JetBrains Mono'; 8 | $blockquote-font-size: $font-size-base * 1.1; 9 | $blockquote-border-color: #ff8c00; 10 | $blockquote-small-color: #bbb; 11 | 12 | $font-size-h1: floor(($font-size-base * 2)); 13 | $font-size-h2: floor(($font-size-base * 1.75)); 14 | $font-size-h3: ceil(($font-size-base * 1.5)); 15 | $font-size-h4: ceil(($font-size-base * 1.25)); 16 | $font-size-h5: ceil(($font-size-base * 1.1)); 17 | $font-size-h6: $font-size-base; 18 | 19 | $screen-xl: 13px; 20 | $screen-lg: 10px; 21 | $screen-md: 7px; 22 | $screen-sm: 4px; 23 | $screen-xs: 1px; 24 | 25 | blockquote { 26 | background-color: #555; 27 | color: #fff; 28 | } 29 | -------------------------------------------------------------------------------- /style/sass/md.scss: -------------------------------------------------------------------------------- 1 | //ş 2 | @import './node_modules/bootstrap-sass/assets/stylesheets/bootstrap/mixins'; 3 | 4 | @import 'variables'; 5 | @import './node_modules/abt-sass/src/variables'; 6 | @import './node_modules/bootstrap-sass/assets/stylesheets/bootstrap/variables'; 7 | 8 | // BOOTSTRAP 9 | 10 | // Reset and dependencies 11 | @import './node_modules/bootstrap-sass/assets/stylesheets/bootstrap/normalize'; 12 | @import './node_modules/bootstrap-sass/assets/stylesheets/bootstrap/print'; 13 | 14 | // Core CSS 15 | @import './node_modules/bootstrap-sass/assets/stylesheets/bootstrap/scaffolding'; 16 | @import './node_modules/bootstrap-sass/assets/stylesheets/bootstrap/type'; 17 | @import './node_modules/bootstrap-sass/assets/stylesheets/bootstrap/code'; 18 | @import './node_modules/bootstrap-sass/assets/stylesheets/bootstrap/tables'; 19 | 20 | // ENDOF BOOTSTRAP 21 | @import './node_modules/abt-sass/src/type'; 22 | 23 | @import 'extra'; 24 | --------------------------------------------------------------------------------