├── .gitattributes
├── .gitignore
├── MarkdownViewer.sln
├── MarkdownViewer
├── App.config
├── Classes
│ ├── Markdown.cs
│ ├── MenuHandler.cs
│ ├── PageController.cs
│ ├── RequestHandler.cs
│ └── SyntaxBrush.cs
├── MarkdownViewer.csproj
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── HTML_TEMPLATE.html
│ ├── MarkdownGuide.html
│ ├── fa-arrow-circle-right.png
│ ├── fa-search.png
│ ├── fonts
│ │ ├── FontAwesome.otf
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.svg
│ │ ├── fontawesome-webfont.ttf
│ │ ├── fontawesome-webfont.woff
│ │ └── fontawesome-webfont.woff2
│ ├── images
│ │ ├── ComputeIconSmall.jpg
│ │ ├── Icon-sm.png
│ │ ├── Icon.png
│ │ ├── favicon.ico
│ │ └── logo.ico
│ ├── scripts
│ │ ├── app.js
│ │ ├── bootstrap.min.js
│ │ ├── jquery.js
│ │ ├── shAutoloader.js
│ │ ├── shCore.js
│ │ └── simplemde.min.js
│ ├── shBrushes
│ │ ├── shBrushAS3.js
│ │ ├── shBrushAppleScript.js
│ │ ├── shBrushBash.js
│ │ ├── shBrushCSharp.js
│ │ ├── shBrushColdFusion.js
│ │ ├── shBrushCpp.js
│ │ ├── shBrushCss.js
│ │ ├── shBrushDelphi.js
│ │ ├── shBrushDiff.js
│ │ ├── shBrushErlang.js
│ │ ├── shBrushGroovy.js
│ │ ├── shBrushJScript.js
│ │ ├── shBrushJava.js
│ │ ├── shBrushJavaFX.js
│ │ ├── shBrushPerl.js
│ │ ├── shBrushPhp.js
│ │ ├── shBrushPlain.js
│ │ ├── shBrushPowerShell.js
│ │ ├── shBrushPython.js
│ │ ├── shBrushRuby.js
│ │ ├── shBrushSass.js
│ │ ├── shBrushScala.js
│ │ ├── shBrushSql.js
│ │ ├── shBrushVb.js
│ │ └── shBrushXml.js
│ └── styles
│ │ ├── app.css
│ │ ├── bootstrap.min.css
│ │ ├── font-awesome.min.css
│ │ ├── shCore.css
│ │ ├── shCoreDefault.css
│ │ └── simplemde.min.css
├── app.manifest
├── frmMain.Designer.cs
├── frmMain.cs
├── frmMain.resx
├── logo.ico
└── packages.config
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.suo
2 | obj/
3 | bin/
4 | Thumbs.db
5 | *.user
6 | workspace.xml
7 | .vscode/
8 | .vs
9 | packages/
10 |
--------------------------------------------------------------------------------
/MarkdownViewer.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}") = "MarkdownViewer", "MarkdownViewer\MarkdownViewer.csproj", "{EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x64 = Debug|x64
12 | Debug|x86 = Debug|x86
13 | Debug64|Any CPU = Debug64|Any CPU
14 | Debug64|x64 = Debug64|x64
15 | Debug64|x86 = Debug64|x86
16 | Debug86|Any CPU = Debug86|Any CPU
17 | Debug86|x64 = Debug86|x64
18 | Debug86|x86 = Debug86|x86
19 | Release|Any CPU = Release|Any CPU
20 | Release|x64 = Release|x64
21 | Release|x86 = Release|x86
22 | Release64|Any CPU = Release64|Any CPU
23 | Release64|x64 = Release64|x64
24 | Release64|x86 = Release64|x86
25 | Release86|Any CPU = Release86|Any CPU
26 | Release86|x64 = Release86|x64
27 | Release86|x86 = Release86|x86
28 | EndGlobalSection
29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
30 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug|Any CPU.ActiveCfg = Debug|x64
31 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug|Any CPU.Build.0 = Debug|x64
32 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug|x64.ActiveCfg = Debug|x64
33 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug|x64.Build.0 = Debug|x64
34 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug|x86.ActiveCfg = Debug|x64
35 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug|x86.Build.0 = Debug|x64
36 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug64|Any CPU.ActiveCfg = Debug64|Any CPU
37 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug64|Any CPU.Build.0 = Debug64|Any CPU
38 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug64|x64.ActiveCfg = Debug64|x64
39 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug64|x64.Build.0 = Debug64|x64
40 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug64|x86.ActiveCfg = Debug64|Any CPU
41 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug64|x86.Build.0 = Debug64|Any CPU
42 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug86|Any CPU.ActiveCfg = Debug86|Any CPU
43 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug86|Any CPU.Build.0 = Debug86|Any CPU
44 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug86|x64.ActiveCfg = Debug86|x64
45 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug86|x64.Build.0 = Debug86|x64
46 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug86|x86.ActiveCfg = Debug86|x86
47 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Debug86|x86.Build.0 = Debug86|x86
48 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release|Any CPU.ActiveCfg = Release|Any CPU
49 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release|Any CPU.Build.0 = Release|Any CPU
50 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release|x64.ActiveCfg = Release|x64
51 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release|x64.Build.0 = Release|x64
52 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release|x86.ActiveCfg = Release|x86
53 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release|x86.Build.0 = Release|x86
54 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release64|Any CPU.ActiveCfg = Release64|Any CPU
55 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release64|Any CPU.Build.0 = Release64|Any CPU
56 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release64|x64.ActiveCfg = Release64|x64
57 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release64|x64.Build.0 = Release64|x64
58 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release64|x86.ActiveCfg = Release64|Any CPU
59 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release64|x86.Build.0 = Release64|Any CPU
60 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release86|Any CPU.ActiveCfg = Release86|Any CPU
61 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release86|Any CPU.Build.0 = Release86|Any CPU
62 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release86|x64.ActiveCfg = Release86|x64
63 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release86|x64.Build.0 = Release86|x64
64 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release86|x86.ActiveCfg = Release86|x86
65 | {EF012DFC-F380-46B7-81ED-7D3D5F8F3AED}.Release86|x86.Build.0 = Release86|x86
66 | EndGlobalSection
67 | GlobalSection(SolutionProperties) = preSolution
68 | HideSolutionNode = FALSE
69 | EndGlobalSection
70 | EndGlobal
71 |
--------------------------------------------------------------------------------
/MarkdownViewer/App.config:
--------------------------------------------------------------------------------
1 |
2 |
37 | {0}
{1}", ex.Message, ex.StackTrace); 38 | Program.Log(this.MarkdownPath, "Exception converting Markdown to HTML\n\t{0}\n\t\t{1}", 39 | ex.Message, ex.StackTrace); 40 | } 41 | 42 | return html; 43 | } 44 | 45 | public bool SaveMarkdown() 46 | { 47 | return Program.SaveMarkdown(); 48 | } 49 | 50 | public void SaveHtml(string html) 51 | { 52 | using (SaveFileDialog d = new SaveFileDialog() 53 | { 54 | AddExtension = true, 55 | DefaultExt = "html", 56 | FileName = Program.MarkdownPath + ".html", 57 | OverwritePrompt = true, 58 | InitialDirectory = Path.GetDirectoryName(Program.MarkdownPath), 59 | Filter = "HTML files (*.html)|*.html|All files (*.*)|*.*", 60 | Title = "Save " + Path.GetFileName(Program.MarkdownPath) + " as..." 61 | }) 62 | { 63 | //As this will be called from within the browser, it will be on another UI thread 64 | Program.MainForm.Invoke(new Action(() => 65 | { 66 | if (d.ShowDialog(Program.MainForm) == DialogResult.OK) 67 | { 68 | File.WriteAllText(d.FileName, html); 69 | Program.MainForm.RunJavscript("alert('" + 70 | d.FileName.Replace(@"\", @"\\") + 71 | @"\nhas been successfully created.');"); 72 | } 73 | })); 74 | } 75 | } 76 | 77 | public bool SaveAsMarkdown() 78 | { 79 | bool success = false; 80 | using (SaveFileDialog d = new SaveFileDialog() 81 | { 82 | AddExtension = true, 83 | DefaultExt = "md", 84 | FileName = Program.MarkdownPath, 85 | OverwritePrompt = true, 86 | InitialDirectory = Path.GetDirectoryName(Program.MarkdownPath), 87 | Filter = "Markdown files (*.md)|*.md|All files (*.*)|*.*", 88 | Title = "Save " + Path.GetFileName(Program.MarkdownPath) + " as..." 89 | }) 90 | { 91 | //As this will be called from within the browser, it will be on another UI thread 92 | Program.MainForm.Invoke(new Action(() => 93 | { 94 | if (d.ShowDialog(Program.MainForm) == DialogResult.OK) 95 | { 96 | File.WriteAllText(d.FileName, this.MarkdownText); 97 | success = true; 98 | Program.MainForm.RunJavscript("alert('" + 99 | d.FileName.Replace(@"\", @"\\") + 100 | @"\nhas been successfully created.');"); 101 | } 102 | })); 103 | } 104 | return success; 105 | } 106 | 107 | public void OpenMarkdown() 108 | { 109 | if (!this.CheckForChanges()) 110 | { 111 | return; 112 | } 113 | using (OpenFileDialog d = new OpenFileDialog() 114 | { 115 | DefaultExt = "md", 116 | FileName = Program.MarkdownPath + ".html", 117 | InitialDirectory = Path.GetDirectoryName(Program.MarkdownPath), 118 | Filter = "Markdown files (*.md)|*.md|All files (*.*)|*.*", 119 | Title = "Open Markdown File" 120 | }) 121 | { 122 | //As this will be called from within the browser, it will be on another UI thread 123 | Program.MainForm.Invoke(new Action(() => 124 | { 125 | if (d.ShowDialog() == DialogResult.OK) 126 | { 127 | Program.ChangeFile(d.FileName); 128 | } 129 | })); 130 | } 131 | } 132 | 133 | public void ShowDevTools() 134 | { 135 | Program.MainForm.ShowDevTools(); 136 | } 137 | 138 | public void ShowGuide() 139 | { 140 | var mdPath = Properties.Settings.Default.MarkdownGuideFile.Replace( 141 | "{{{RESOURCES_DIRECTORY}}}", Program.ResourcesDirectory); 142 | if (!File.Exists(mdPath)) 143 | { 144 | mdPath = Properties.Settings.Default.MarkDownGuideURL; 145 | } 146 | Process.Start(mdPath); 147 | } 148 | 149 | public void PrintToPdf() 150 | { 151 | using (SaveFileDialog d = new SaveFileDialog() 152 | { 153 | AddExtension = true, 154 | DefaultExt = "pdf", 155 | FileName = Program.MarkdownPath + ".pdf", 156 | OverwritePrompt = true, 157 | InitialDirectory = Path.GetDirectoryName(Program.MarkdownPath), 158 | Filter = "PDF files (*.pdf)|*.pdf|All files (*.*)|*.*", 159 | Title = "Print to PDF - " + Path.GetFileName(Program.MarkdownPath) 160 | }) 161 | { 162 | //As this will be called from within the browser, it will be on another UI thread 163 | Program.MainForm.Invoke(new Action(() => 164 | { 165 | if (d.ShowDialog(Program.MainForm) == DialogResult.OK) 166 | { 167 | Program.MainForm.PrintToPdf(d.FileName); 168 | Program.MainForm.RunJavscript("alert('" + 169 | d.FileName.Replace(@"\", @"\\") + 170 | @"\nhas been successfully created.');"); 171 | } 172 | })); 173 | } 174 | } 175 | 176 | public void SetBrowserState(int state) 177 | { 178 | Program.BrowserState = (BrowserStates)state; 179 | } 180 | 181 | public void ToggleFind() 182 | { 183 | //As this will be called from within the browser, it will be on another UI thread 184 | Program.MainForm.Invoke(new Action(() => 185 | { 186 | Program.MainForm.ToggleFind(); 187 | })); 188 | } 189 | 190 | public string Version() 191 | { 192 | return System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString(); 193 | } 194 | 195 | public void DoKeyUp(int keyCode, bool control, bool shift, bool alt, string selectedText) 196 | { 197 | //As this will be called from within the browser, it will be on another UI thread 198 | Program.MainForm.Invoke(new Action(() => 199 | { 200 | Program.MainForm.DoKeyUp((Keys)keyCode, control, shift, alt, selectedText); 201 | })); 202 | } 203 | 204 | ///
58 |
**bold** 43 | *italics* 44 | ~~45 |strikethrough~~
# Big header 47 | ## Medium header 48 | ### Small header 49 | #### Tiny header50 |
* Generic list item 52 | * Generic list item 53 | * Generic list item 54 | 1. Numbered list item 55 | 2. Numbered list item 56 | 3. Numbered list item57 |
[Text to display](http://www.example.com)59 |
> This is a quote. 61 | > It can span multiple lines!62 |
64 |
| Column 1 | Column 2 | Column 3 | 66 | | -------- | -------- | -------- | 67 | | John | Doe | Male | 68 | | Mary | Smith | Female | 69 | Or without aligning the columns... 70 | | Column 1 | Column 2 | Column 3 | 71 | | -------- | -------- | -------- | 72 | | John | Doe | Male | 73 | | Mary | Smith | Female | 74 |75 |
`var example = "hello!";` 77 | Or spanning multiple lines... 78 | ``` 79 | var example = "hello!"; 80 | alert(example); 81 | ```82 | 83 |
A clean and quick Markdown file viewer for Windows.126 |