diff --git a/src/Markdig.WebApp/ApiController.cs b/src/Markdig.WebApp/ApiController.cs
new file mode 100644
index 00000000..73caae50
--- /dev/null
+++ b/src/Markdig.WebApp/ApiController.cs
@@ -0,0 +1,27 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Markdig.WebApp
+{
+ public class ApiController : Controller
+ {
+ // GET api/to_html?text=xxx
+ [Route("api/to_html")]
+ [HttpGet()]
+ public object Get([FromQuery] string text)
+ {
+ if (text == null)
+ {
+ text = string.Empty;
+ }
+
+ if (text.Length > 1000)
+ {
+ text = text.Substring(0, 1000);
+ }
+
+ var pipeline = new MarkdownPipelineBuilder().UseAllExtensions().Build();
+ var result = Markdown.ToHtml(text, pipeline);
+
+ return new {name = "markdig", html = result, version = Markdown.Version};}
+ }
+}
diff --git a/src/Markdig.WebApp/Markdig.WebApp.xproj b/src/Markdig.WebApp/Markdig.WebApp.xproj
new file mode 100644
index 00000000..42fdd247
--- /dev/null
+++ b/src/Markdig.WebApp/Markdig.WebApp.xproj
@@ -0,0 +1,19 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ 3cad9801-9976-46be-baca-f6d0d21fdc00
+ Markdig.WebApp
+ .\obj
+ .\bin\
+ v4.5
+
+
+ 2.0
+
+
+
diff --git a/src/Markdig.WebApp/Program.cs b/src/Markdig.WebApp/Program.cs
new file mode 100644
index 00000000..fcc43656
--- /dev/null
+++ b/src/Markdig.WebApp/Program.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Builder;
+
+namespace Markdig.WebApp
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ var host = new WebHostBuilder()
+ .UseKestrel()
+ .UseContentRoot(Directory.GetCurrentDirectory())
+ .UseIISIntegration()
+ .UseStartup()
+ .Build();
+
+ host.Run();
+ }
+ }
+}
diff --git a/src/Markdig.WebApp/Properties/PublishProfiles/markdig - Web Deploy-publish.ps1 b/src/Markdig.WebApp/Properties/PublishProfiles/markdig - Web Deploy-publish.ps1
new file mode 100644
index 00000000..52d60062
--- /dev/null
+++ b/src/Markdig.WebApp/Properties/PublishProfiles/markdig - Web Deploy-publish.ps1
@@ -0,0 +1,111 @@
+# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
+# Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+[cmdletbinding(SupportsShouldProcess=$true)]
+param($publishProperties=@{}, $packOutput, $pubProfilePath, $nugetUrl)
+
+# to learn more about this file visit https://go.microsoft.com/fwlink/?LinkId=524327
+$publishModuleVersion = '1.1.0'
+
+function Get-PublishModulePath{
+ [cmdletbinding()]
+ param()
+ process{
+ $keysToCheck = @('hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\{0}',
+ 'hklm:\SOFTWARE\Microsoft\VisualStudio\{0}',
+ 'hklm:\SOFTWARE\Wow6432Node\Microsoft\VWDExpress\{0}',
+ 'hklm:\SOFTWARE\Microsoft\VWDExpress\{0}'
+ )
+ $versions = @('14.0', '15.0')
+
+ [string]$publishModulePath=$null
+ :outer foreach($keyToCheck in $keysToCheck){
+ foreach($version in $versions){
+ if(Test-Path ($keyToCheck -f $version) ){
+ $vsInstallPath = (Get-itemproperty ($keyToCheck -f $version) -Name InstallDir -ErrorAction SilentlyContinue | select -ExpandProperty InstallDir -ErrorAction SilentlyContinue)
+
+ if($vsInstallPath){
+ $installedPublishModulePath = "{0}Extensions\Microsoft\Web Tools\Publish\Scripts\{1}\" -f $vsInstallPath, $publishModuleVersion
+ if(!(Test-Path $installedPublishModulePath)){
+ $vsInstallPath = $vsInstallPath + 'VWDExpress'
+ $installedPublishModulePath = "{0}Extensions\Microsoft\Web Tools\Publish\Scripts\{1}\" -f $vsInstallPath, $publishModuleVersion
+ }
+ if(Test-Path $installedPublishModulePath){
+ $publishModulePath = $installedPublishModulePath
+ break outer;
+ }
+ }
+ }
+ }
+ }
+
+ $publishModulePath
+ }
+}
+
+$publishModulePath = Get-PublishModulePath
+
+$defaultPublishSettings = New-Object psobject -Property @{
+ LocalInstallDir = $publishModulePath
+}
+
+function Enable-PackageDownloader{
+ [cmdletbinding()]
+ param(
+ $toolsDir = "$env:LOCALAPPDATA\Microsoft\Web Tools\Publish\package-downloader-$publishModuleVersion\",
+ $pkgDownloaderDownloadUrl = 'https://go.microsoft.com/fwlink/?LinkId=524325') # package-downloader.psm1
+ process{
+ if(get-module package-downloader){
+ remove-module package-downloader | Out-Null
+ }
+
+ if(!(get-module package-downloader)){
+ if(!(Test-Path $toolsDir)){ New-Item -Path $toolsDir -ItemType Directory -WhatIf:$false }
+
+ $expectedPath = (Join-Path ($toolsDir) 'package-downloader.psm1')
+ if(!(Test-Path $expectedPath)){
+ 'Downloading [{0}] to [{1}]' -f $pkgDownloaderDownloadUrl,$expectedPath | Write-Verbose
+ (New-Object System.Net.WebClient).DownloadFile($pkgDownloaderDownloadUrl, $expectedPath)
+ }
+
+ if(!$expectedPath){throw ('Unable to download package-downloader.psm1')}
+
+ 'importing module [{0}]' -f $expectedPath | Write-Output
+ Import-Module $expectedPath -DisableNameChecking -Force
+ }
+ }
+}
+
+function Enable-PublishModule{
+ [cmdletbinding()]
+ param()
+ process{
+ if(get-module publish-module){
+ remove-module publish-module | Out-Null
+ }
+
+ if(!(get-module publish-module)){
+ $localpublishmodulepath = Join-Path $defaultPublishSettings.LocalInstallDir 'publish-module.psm1'
+ if(Test-Path $localpublishmodulepath){
+ 'importing module [publish-module="{0}"] from local install dir' -f $localpublishmodulepath | Write-Verbose
+ Import-Module $localpublishmodulepath -DisableNameChecking -Force
+ $true
+ }
+ }
+ }
+}
+
+try{
+
+ if (!(Enable-PublishModule)){
+ Enable-PackageDownloader
+ Enable-NuGetModule -name 'publish-module' -version $publishModuleVersion -nugetUrl $nugetUrl
+ }
+
+ 'Calling Publish-AspNet' | Write-Verbose
+ # call Publish-AspNet to perform the publish operation
+ Publish-AspNet -publishProperties $publishProperties -packOutput $packOutput -pubProfilePath $pubProfilePath
+}
+catch{
+ "An error occurred during publish.`n{0}" -f $_.Exception.Message | Write-Error
+}
\ No newline at end of file
diff --git a/src/Markdig.WebApp/Properties/launchSettings.json b/src/Markdig.WebApp/Properties/launchSettings.json
new file mode 100644
index 00000000..6f1cbd43
--- /dev/null
+++ b/src/Markdig.WebApp/Properties/launchSettings.json
@@ -0,0 +1,28 @@
+{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:65396/",
+ "sslPort": 0
+ }
+ },
+ "profiles": {
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "api/values",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "Markdig.WebApp": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "launchUrl": "http://localhost:5000/api/to_html?text=yes",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Markdig.WebApp/Startup.cs b/src/Markdig.WebApp/Startup.cs
new file mode 100644
index 00000000..ddcd083d
--- /dev/null
+++ b/src/Markdig.WebApp/Startup.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+
+namespace Markdig.WebApp
+{
+ public class Startup
+ {
+ public Startup(IHostingEnvironment env)
+ {
+ var builder = new ConfigurationBuilder()
+ .SetBasePath(env.ContentRootPath)
+ .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
+ .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
+
+ if (env.IsEnvironment("Development"))
+ {
+ // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
+ builder.AddApplicationInsightsSettings(developerMode: true);
+ }
+
+ builder.AddEnvironmentVariables();
+ Configuration = builder.Build();
+ }
+
+ public IConfigurationRoot Configuration { get; }
+
+ // This method gets called by the runtime. Use this method to add services to the container
+ public void ConfigureServices(IServiceCollection services)
+ {
+ // Add framework services.
+ services.AddApplicationInsightsTelemetry(Configuration);
+
+ services.AddMvc();
+ }
+
+ // This method gets called by the runtime. Use this method to configure the HTTP request pipeline
+ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
+ {
+ loggerFactory.AddConsole(Configuration.GetSection("Logging"));
+ loggerFactory.AddDebug();
+
+ app.UseApplicationInsightsRequestTelemetry();
+
+ app.UseApplicationInsightsExceptionTelemetry();
+
+ app.UseMvc();
+ }
+ }
+}
diff --git a/src/Markdig.WebApp/appsettings.json b/src/Markdig.WebApp/appsettings.json
new file mode 100644
index 00000000..fa8ce71a
--- /dev/null
+++ b/src/Markdig.WebApp/appsettings.json
@@ -0,0 +1,10 @@
+{
+ "Logging": {
+ "IncludeScopes": false,
+ "LogLevel": {
+ "Default": "Debug",
+ "System": "Information",
+ "Microsoft": "Information"
+ }
+ }
+}
diff --git a/src/Markdig.WebApp/project.json b/src/Markdig.WebApp/project.json
new file mode 100644
index 00000000..862fb6fd
--- /dev/null
+++ b/src/Markdig.WebApp/project.json
@@ -0,0 +1,58 @@
+{
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "version": "1.0.0-rc2-3002702",
+ "type": "platform"
+ },
+ "Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
+ "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
+ "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
+ "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
+ "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
+ "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",
+ "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
+ "Microsoft.Extensions.Logging": "1.0.0-rc2-final",
+ "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
+ "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
+ "Markdig": "0.2.1"
+ },
+
+ "tools": {
+ "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
+ "version": "1.0.0-preview1-final",
+ "imports": "portable-net45+win8+dnxcore50"
+ }
+ },
+
+ "frameworks": {
+ "netcoreapp1.0": {
+ "imports": [
+ "dotnet5.6",
+ "dnxcore50",
+ "portable-net45+win8"
+ ]
+ }
+ },
+
+ "buildOptions": {
+ "emitEntryPoint": true,
+ "preserveCompilationContext": true
+ },
+
+ "runtimeOptions": {
+ "gcServer": true
+ },
+
+ "publishOptions": {
+ "include": [
+ "wwwroot",
+ "Views",
+ "appsettings.json",
+ "web.config"
+ ]
+ },
+
+ "scripts": {
+ "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
+ }
+}
diff --git a/src/Markdig.WebApp/web.config b/src/Markdig.WebApp/web.config
new file mode 100644
index 00000000..dc0514fc
--- /dev/null
+++ b/src/Markdig.WebApp/web.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/markdig.sln b/src/markdig.sln
index 87e6d422..0ff8a9c3 100644
--- a/src/markdig.sln
+++ b/src/markdig.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.24720.0
+VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Markdig", "Markdig\Markdig.xproj", "{8A58A7E2-627C-4F41-933F-5AC92ADFAB48}"
EndProject
@@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Markdig.Benchmarks", "Markd
{8A58A7E2-627C-4F41-933F-5AC92ADFAB48} = {8A58A7E2-627C-4F41-933F-5AC92ADFAB48}
EndProjectSection
EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Markdig.WebApp", "Markdig.WebApp\Markdig.WebApp.xproj", "{3CAD9801-9976-46BE-BACA-F6D0D21FDC00}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -38,6 +40,10 @@ Global
{6A19F040-BC7C-4283-873A-177B5324F1ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A19F040-BC7C-4283-873A-177B5324F1ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A19F040-BC7C-4283-873A-177B5324F1ED}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3CAD9801-9976-46BE-BACA-F6D0D21FDC00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3CAD9801-9976-46BE-BACA-F6D0D21FDC00}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3CAD9801-9976-46BE-BACA-F6D0D21FDC00}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3CAD9801-9976-46BE-BACA-F6D0D21FDC00}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE