GithubHelp home page GithubHelp logo

knagis / commonmark.net Goto Github PK

View Code? Open in Web Editor NEW
998.0 998.0 147.0 1.53 MB

Implementation of CommonMark specification in C# for converting Markdown documents to HTML. Optimized for maximum performance and portability.

License: BSD 3-Clause "New" or "Revised" License

C# 99.62% Perl 0.38%

commonmark.net's People

Contributors

arthrp avatar dmitry-shechtman avatar donchak avatar iignatov avatar joebuschmann avatar josephwoodward avatar knagis avatar meziantou avatar sharwell avatar stevehansen avatar zoomcharts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

commonmark.net's Issues

Write a wiki page that demonstrates the use of Block.AsEnumerable()

The new Block.AsEnumerable() method can be used to quickly modify the document tree or write custom outputs and thus might be very useful for people who want to try out things and don't need maximum performance.

Readme.md must be then modified to point to this page instead of issue #4.

Project no longer builds in VS2013

Looks like abf31ed introduced a bunch of uses of nameof, which is a C# 6 feature not available in Visual Studio 2013. (According to this there was an end user preview that enabled its use in VS2013, but it's long been out-of-date and has since been closed entirely.)

Unfortunately, that means the project simply won't build in anything other than VS2015, despite what the readme suggests.

Add a license.

I want to use this implementation of CommonMark in one of my projects, but I would prefer to know the license in advance.

What's the best way to add extensions?

I want to add a few basic extensions using CommonMark.NET: image dimensions/alignment and tables.

Is there a way of plugging into the parser yet to do this? Some suggestions on the CommonMark forum suggest putting the image dimensions in the alt part of the image tag, which I can handle with a CustomHtmlFormatter but the tables looks a lot more involved.

Any suggestions would be welcomed!

Unable to load CommonMark.Base project in Visual Studio 2013

Keep getting following error message:

D:\Code\CommonMark.NET\CommonMark\CommonMark.Base.csproj : error  : The project file 'CommonMark.Base' cannot be opened.
The project is targeting frameworks that are either not installed or are included as part of future updates to Visual Studio. See http://go.microsoft.com/fwlink/?LinkID=287985 for more information.

It would be great if you can provide more info about development env setup.

Subscript tilde

Hi @Knagis,

As mentioned elsewhere, I managed to add ^superscript^ and subscript, and both work well, although they don't yet conform to the Pandoc spec, which permits no unescaped spaces between the delimiters.

The superscript was the easiest part, although the subscript wasn't too hard as well - I basically created a replica of HandleEmphasis with only minor changes.

However, there's a problem. Since the tilde is already taken by strikeout, I can't disable strikeout while subscript is enabled. I tried the following:

    InlineTag? doubleCharTag = InlineTag.Strikethrough;
    if (0 == (settings.AdditionalFeatures & CommonMarkAdditionalFeatures.StrikethroughTilde))
        doubleCharTag = null;

but that causes an InvalidOperationException (Nullable object must have a value) here:

    inl.Tag = useDelims == 1 ? singleCharTag.Value : doubleCharTag.Value;

Any ideas? Thanks.

Syntax Highlighting for Editors

I'm using CommonMark.NET for a Windows based Markdown editor. (https://github.com/mike-ward/Markdown-Edit). Currently, I'm using regex's for syntax highlighting source (not rendered output, but source), which has lots of limitations due to the block nature of the language.

So..., I was thinking, it might be very cool to generate text segments with metadata for use with source highlighting. This could be used to correctly highlight source markdown. Is this something you would be interested in collaborating on?

Keep StartLine/EndLine/StartColumn

Hi,

I'm using CommonMark.NET for parsing.

I have a converter on top of it, which should present warnings like

invalid link target on line {0} position {1}

I don't think that would be possible with just SourcePosition and SourceLength.

Provide "Parse" method to return a syntax tree

It would be nice if a Parse method was provided in addition to the current Convert method, which converts input to a syntax tree instead of rendering it to text.

Of course the current code can produce this result, but it requires the user knowing to call ProcessStage1 and ProcessStage2, but not ProcessStage3.

DNX Core 5.0 reference not found on solution open

AIA.

I pulled and opened CommonMark.NET in VS 2015 Community on Windows 8.1, and the CommonMark.NETCore project is missing its references related to DNX Core 5.0, and is therefore unbuildable for me.

commonmarkissues

A little not-that-helpful googling suggests DNX Core is a platform-neutral-ish subset of the .NET runtime, but most of the hits for searching it and "install" (that I found) seem to suggest its ASP.NET related. ?? The only DNX related open issue in CommonMark now is this one, which is unrelated, and there are no closed that seem related either.

What do I need to do to get this CommonMark prereq configured correctly?

Tables

I would like to be able to support tables as specified in GitHub Flavored Markdown in a C# project I am working on.

Does this component provide support for this?

Many thanks.

Advice please - offset heading levels

I'm currently using CommonMark.NET and I have a scenario I'm trying to enable, but I'm not sure how to approach. In short, I need to be able to offset the levels of the generated heading levels. Normally when I run a string through I expect a '#' to generate an H1 and '##' to generate H2, etc. But sometimes I'm going to be embedding the generated HTML into a context in which there is already an H1 (or an H2, etc.). So what I'd ideally like is some way to pass in a headingOffsetLevel that would by default be 0 but I could pass in a 1 to make '#' generate H2s, a 2 to make '#' generate H3s, etc.

I haven't gone into the CommonMark code yet to try to understand how to approach this. I'd appreciate any input about the best way to approach this. Assuming such a magic parameter isn't already built in, would there be a best way to leverage one of the extensibility mechanisms for this?

Html block in code span is interpreted as markup

Steps to reproduce.

Result - All paragraphs are red.

Possible cause: There's a <style> tag at line 2033. It's inside a code span but appears to be interpreted as a style block.

Markdown Edit is using the latest version of CommonMark.NET.

Note: I tried to repro this with CommonMark.NET console but I couldn't get the current package to build due to issues with DNX core.

image

Tight lists

Hi,

I seem to be getting paragraphs in list items regardless of blank lines in the input. Is that a known issue, or am I missing something?

Change from MSUnit to NUnit/XUnit?

Are there any plans to switching the unit testing framework from MSTest to NUnit or XUnit? The latter work a bit better with CI servers (I'm thinking of Travis), for example I managed to get a build passing on Travis with a few bits of search and replace:

You can get a free copy of Resharper if you have an OS project, if running the tests on your own machine inside Visual Studio is the issue.

Parser Bug

LInes ending in

[some text](

cause a line parser exception.

tag length limit 10???

My markdown sometimes includes tags that I want passed through but they are longer than 10 characters. The hard coded limit of 10 characters is a problem and the parser just ungracefully crashes. I can deal with catching the parser failure, but is there some reason the tag name length is fixed here? Couldn't this just build a string of effectively unlimited length?

The problem appears to be line 153 in the scanner:

var tagname = new char[10];

Extensibilty

I'm looking to replace Markdown.Deep with CommonMark.NET on a documentation project I'm working on.

Critical thing I found missing is the ability to process relative urls.
For example, I would like to replace ~/ with application path.

Other thing I would like to see is support for strikethrough syntax using (~~) and other GitHub flavor extensions.

Is there a plan for adding such features?

I would love to help.

Rendering of HTML content in documents

Hello,

I'm working on porting an application to use CommonMark.NET and I've run into an issue with a rendering difference. In our existing library, HTML content is allowed to have spaces and it will still be rendered as html. In this library, if a block of HTML has a line break, the rest of the HTML will be interpreted as a markdown code block.

See gist for example: https://gist.github.com/NathanCastle/b3ca963a0cef55b664a4

I'm wondering if there is any way that this alternative handling of HTML blocks could be incorporated into the core library, either as the default behavior or as an option. After all, it is pretty common for HTML to have line breaks.

Add option to include ID in headers

Markdown pages that contains links which point to headers don't convert correctly. The links are
translated correctly but the headers don't get the ID value in order for the links to hook up correctly.

Example of source:

## Table of Contents
* **[Solution Overview](#solution-overview)**

## Solution Overview

Example of desired results:

<h2>Table of Contents</h2>
<ul>
    <li><a ref="#solution-overview">Solution Overview</a></li>
</ul>

<h2 id="soluton-overview>Solution Overview</h2>

Incorrect source position mapping when blockquotes are involved

>>*foo
 >  >bar*

Both the paragraph and emphasis nodes (also the inner blockquote) will include the > characters from the second line in their contents. This is incorrect, but the fix would require that the source position mapping is stored as a list, instead of two integers.

The solution would probably require tracking of positions in each block that are taken by the prefixes so that for any child blocks or inlines these positions could be subtracted from the single position/length pair dividing it into multiple.

For now the intention is to leave it as is and revisit this issue if there are enough actual use cases for it.

Custom containers

Hey,

I'm trying to add ::: custom containers (similar to markdown-it).

This is where I got so far. Child inlines seem to work OK, but child blocks don't (I only need paragraphs as a minimum requirement).

Any help would be greatly appreciated.

Extensions

@Knagis,

So I've had some solid progress on enabling extensions. Now I'd appreciate your feedback on pre-existing features in this regard.

  1. Strikeout

    seems to me as an obvious candidate.

  2. Line breaks

    I believe this one should also be an extension.

  3. Unicode bullet

    I didn't see it mentioned anywhere in the spec. Extension?

  4. HtmlFormatter + OutputDelegate

    Are two different formatters really required? AFAIK one of these was added as a means to enable customizations. Since we now have a modular design, no modifications to the bulk formatters should be required.

  5. TrackSourcePosition

    The implementation would obviously remain deeply integrated, just the API would be a little cleaner, similarly to the reference label case extension.

  6. UriResolver

    Need I say more?

  7. Anything else?

Thanks

Edit: Added omissions and turned into checklist.

Parallel Stage 2

Hey,

I added a branch that contains a tentative parallelization of Stage 2. I didn't see a significant improvement in CommonBenchMark, so maybe this isn't worth pursuing.

Please let me know what you think.

Thanks

AST Inline Blocks: LiteralContent empty for links and images

LiteralContent for links and images in the AST are empty. Docs say it should have the title.

I want to highlight only the url portion of the link.

It would be useful to know the source offset of the actual link, but it can be inferred provided the LiteralContent property is empty for autolinks.

Target Frame for InlineContentLinkable

What I want to do is to be able to make all URLs open in a new tab/window.

So I tried your #4 and found that InlineContentLinkable only supports the URL and the title.

My question:

Any chance to have a future version support passing targets during rendering stage?

Razor-style templating

I am looking to create a view controller that uses markdown files with Razor-style embedded C# to create templates. I want to translate the markdown parts of the view into html using CommonMark.NET, with the C# sections embedded as string literals. I plan to Emit classes that contain the rendered markdown as static strings that are written to the output stream, interspersed with C#. E.G. this:

@{
    CommonMarkSettings.UrlResolver = VirtualPathUtility.ToAbsolute;
    var count = Model.Messages.Count();
}

Home
----

You have [@count unread messages](~/Messages).

Would result in an emitted class equivalent to this:

class Home_CSMD__DB7A756A_1901_4800_9C36_F8037D40697B
{
    public static readonly DateTime DateCreated;

    public void Write(TextWriter writer)
    {
        CommonMarkSettings.UrlResolver = VirtualPathUtility.ToAbsolute;
        var count = Model.Messages.Count();

        writer.Write("<h1>Home</h1>");
        writer.Write("<p>You have <a href='{0}'>{1} unread messages</a>.</p>", CommonMarkSettings.UrlResolver("~/Messages"), count);
    }
}

I want to parse and render the markdown once per file version, so using T4 to generate an intermediate step that is then parsed by CommonMark.NET is not an option. Since Issue #4 and #5 make it clear that you have no plans to support extensibility, I assume my best option is to fork CommonMark.NET? Can you tell me where the best place to add such extensions in your code would be?

Full disclosure: I would be doing this as part of a project for my employer and might not be able to release the source of my modifications.

Output different than CommonMark dingus

The markdown text:

##### Relativity

---

##### Quadratic Equation

---

##### Cauchy's Integral Formula

---

outputs

<h5>Cauchy's Integral Formula</h5>
<hr>

This output is missing serveral elements.

The CommonMark.org dingus emits the expected out.

P.S. I couldn't build CommonMark.Net's console program due to packaging errors (something with DNX Core won't package restore) so I'm using the lastest build of Markdown Edit, which uses the latest build of CommonMark.Net.

CommonMarkConverter Exception in ProcessingStage1

The text

* *

(two astericks separated by a space)

causes the following exception:

CommonMark.CommonMarkException was unhandled
Message: An unhandled exception of type 'CommonMark.CommonMarkException' occurred in CommonMark.dll
Additional information: An error occurred while finalizing open containers.

Steps to reproduce:

The program faults in CommoinMarkConverter.ProcessingStage1.

Inheritance security rules violated while overriding member

After deploying my MVC site to my shared IIS host, I get the exception bellow.

The solution to fix this issue, seems to just mark GetObjectData with SecurityCriticalAttribute in file https://github.com/Knagis/CommonMark.NET/blob/master/CommonMark/CommonMarkException.cs

This is what is said here to solve this issue.

Server Error in '/' Application.
Inheritance security rules violated while overriding member: 'CommonMark.CommonMarkException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Inheritance security rules violated while overriding member: 'CommonMark.CommonMarkException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[TypeLoadException: Inheritance security rules violated while overriding member: 'CommonMark.CommonMarkException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.]
   CommonMark.CommonMarkConverter.ProcessStage1(TextReader source, CommonMarkSettings settings) +0
   CommonMark.CommonMarkConverter.Convert(TextReader source, TextWriter target, CommonMarkSettings settings) +34
   CommonMark.CommonMarkConverter.Convert(String source, CommonMarkSettings settings) +115
   MI_MVC.Models.BlogFileSystemManager.GetBlogListings() +348
   MI_MVC.Controllers.HomeController.Index(Nullable`1 page) +36
   lambda_method(Closure , ControllerBase , Object[] ) +104
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +54
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +28
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +54
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +54
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9658396
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248

Fix appveyor build

The newest nuget no longer plays nice with all the project files being in the same folder - it tries to load project.json for non-DNX projects and fails.

C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(89,5): error : Couldn't find the required information in the lock file. Make sure you have .NETPortable,Version=v4.0,Profile=Profile328 mentioned in your targets. [C:\projects\commonmark-net\CommonMark\CommonMark.Base.csproj]

Since nuget package restore is not used, the Microsoft.NuGet.targets file should not be run at all. It is not included in any project file so it probably gets included through some intermediate .targets file.

appVeyor config:

version: 1.0.{build}
os: Visual Studio 2015
configuration:
- Release
- Debug
environment:
  DNX_FEED: https://www.nuget.org/api/v2
install:
- cmd: >-
    set PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%

    dnvm install latest -r coreclr -a x86 -NoNative

    dnvm install latest -r clr -a x86 -NoNative

    dnu restore
build:
  parallel: true
  verbosity: minimal

Output as Text

I'm back with my hat in hand :)

Plain text output please, with hard line breaks at a set column.

Currently I do this with pandoc

pandoc -f markdown -t markdown --columns=80 document.md > newdocument.md

Then I could build a refomatter into Markdown Edit.

Superscript caret

Hello again,

I cloned SubscriptTests (which are themselves a revised copy of StrikethroughTests), and this fails:

    public void SuperscriptExample10()
    {
        // '[' char in the middle will delay the ^^ match to the post-process phase.
        Helpers.ExecuteTest("foo ^^ba[r^^", "<p>foo <sup><sup>ba[r</sup></sup></p>", Settings);
    }

Expected:

  <<p>foo <sup><sup>ba[r</sup></sup></p>>.

Actual:

  <<p>foo <strong>ba[r</strong></p>>.

The funny thing is the same example in subscript passes.

Any ideas? Does this have to do with InlineStackPriority.Emphasis? Should I create a new priority value for sub/sup?

Array overflow bug

In the below code, j can == 10 which exceeds the tagname array bounds:

public static bool scan_html_block_tag(string s, int pos)
{
...
        var tagname = new char[10];
        while (((nextChar >= 'A' && nextChar <= 'Z') || (nextChar >= 'a' && nextChar <= 'z')) && j <= 10 && ++i < s.Length)
        {
            tagname[j++] = nextChar;
            nextChar = s[i];
        }
}

Fault when parsing empty string

This is new. When I parse an empty string with Source Tracking enabled I get the following exception and stack trace:

CommonMark.CommonMarkException was unhandled
  HResult=-2146233088
  Message=An error occurred while finalizing open containers.
  Source=CommonMark
  StackTrace:
       at CommonMark.CommonMarkConverter.ProcessStage1(TextReader source, CommonMarkSettings settings) in C:\Users\knagis\SkyDrive\Programming\CommonMark\CommonMark\CommonMarkConverter.cs:line 151
       at MarkdownEdit.Models.MarkdownHighlightingColorizer.ParseDocument(String text) in C:\Users\Mike\Documents\GitHub\MarkdownEdit\src\MarkdownEdit\Models\MarkdownHighlightingColorizer.cs:line 187
       at MarkdownEdit.Models.MarkdownHighlightingColorizer.OnTextChanged(String text) in C:\Users\Mike\Documents\GitHub\MarkdownEdit\src\MarkdownEdit\Models\MarkdownHighlightingColorizer.cs:line 173
       at MarkdownEdit.Controls.Editor.<>c__DisplayClass13.<SetupSyntaxHighlighting>b__14(Object s, EventArgs e) in C:\Users\Mike\Documents\GitHub\MarkdownEdit\src\MarkdownEdit\Controls\Editor.xaml.cs:line 107
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at MarkdownEdit.Controls.Editor.EditBoxOnTextChanged(Object sender, EventArgs eventArgs) in C:\Users\Mike\Documents\GitHub\MarkdownEdit\src\MarkdownEdit\Controls\Editor.xaml.cs:line 480
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at ICSharpCode.AvalonEdit.TextEditor.OnTextChanged(EventArgs e)
       at ICSharpCode.AvalonEdit.TextEditor.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
       at ICSharpCode.AvalonEdit.TextEditor.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
       at System.Windows.WeakEventManager.ListenerList.DeliverEvent(Listener& listener, Object sender, EventArgs args, Type managerType)
       at System.Windows.WeakEventManager.ListenerList.DeliverEvent(Object sender, EventArgs args, Type managerType)
       at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
       at ICSharpCode.AvalonEdit.Document.TextDocument.FireChangeEvents()
       at ICSharpCode.AvalonEdit.Document.TextDocument.EndUpdate()
       at ICSharpCode.AvalonEdit.Document.TextDocument.Replace(Int32 offset, Int32 length, ITextSource text, OffsetChangeMap offsetChangeMap)
       at ICSharpCode.AvalonEdit.Document.TextDocument.Replace(Int32 offset, Int32 length, String text)
       at ICSharpCode.AvalonEdit.Document.TextDocument.set_Text(String value)
       at ICSharpCode.AvalonEdit.TextEditor.set_Text(String value)
       at MarkdownEdit.Controls.Editor.set_Text(String value) in C:\Users\Mike\Documents\GitHub\MarkdownEdit\src\MarkdownEdit\Controls\Editor.xaml.cs:line 500
       at MarkdownEdit.Controls.Editor.<NewFile>b__21() in C:\Users\Mike\Documents\GitHub\MarkdownEdit\src\MarkdownEdit\Controls\Editor.xaml.cs:line 235
       at MarkdownEdit.Controls.Editor.Execute(Action action) in C:\Users\Mike\Documents\GitHub\MarkdownEdit\src\MarkdownEdit\Controls\Editor.xaml.cs:line 222
       at MarkdownEdit.Controls.Editor.NewFile() in C:\Users\Mike\Documents\GitHub\MarkdownEdit\src\MarkdownEdit\Controls\Editor.xaml.cs:line 232
       at MarkdownEdit.Controls.MainWindow.ExecuteNewFile(Object sender, ExecutedRoutedEventArgs ea) in C:\Users\Mike\Documents\GitHub\MarkdownEdit\src\MarkdownEdit\Controls\MainWindow.xaml.cs:line 128
       at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
       at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
       at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
       at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
       at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
       at System.Windows.Input.CommandManager.TranslateInput(IInputElement targetElement, InputEventArgs inputEventArgs)
       at System.Windows.UIElement.OnKeyDownThunk(Object sender, KeyEventArgs e)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
       at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
       at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
       at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled)
       at System.Windows.Interop.ThreadMessageEventHandler.Invoke(MSG& msg, Boolean& handled)
       at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at MarkdownEdit.App.Main() in C:\Users\Mike\Documents\GitHub\MarkdownEdit\src\MarkdownEdit\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
       HResult=-2147467261
       Message=Object reference not set to an instance of an object.
       Source=CommonMark
       StackTrace:
            at CommonMark.Parser.BlockMethods.Finalize(Block b, LineInfo line) in C:\Users\knagis\SkyDrive\Programming\CommonMark\CommonMark\Parser\BlockMethods.cs:line 110
            at CommonMark.CommonMarkConverter.ProcessStage1(TextReader source, CommonMarkSettings settings) in C:\Users\knagis\SkyDrive\Programming\CommonMark\CommonMark\CommonMarkConverter.cs:line 141
       InnerException: 

Output as Text

I'm back with my hat in hand :)

Plain text output please, with hard line breaks at a set column.

Currently I do this with pandoc

pandoc -f markdown -t markdown --columns=80 document.md > newdocument.md

Then I could build refomatter into Markdown Edit.

Html output extensibility

CommonMark.NET is awesome but I just need to override some html output in some cases.
Actually if I understand well I need to duplicate HtmlPrinter in my project and override the tiny part I want.

Is it possible to add some extensibility to the ProcessStage3?
For example we can provide a Func<TextWriter, Block, bool> which be called in BlocksToHtmlInner in the while (block != null) part and if it's returns true it continue to the next sibling.

Or make HtmlPrinter public with BlocksToHtmlInner virtual?

I know it's not that simple in either case, but if you are ok I can try something and propose a PR.

Incorrect info in readme?

Note that Express for Windows is the only free edition that supports PCL projects.

Shouldn't VS Community edition support it as well? AFAIK it supports everything that VS Express does, and more.

Consider updating license to 2-clause BSD

The reference code for the C version of the parser was recently relaxed slightly to use the 2-clause BSD license (see commonmark/cmark@58ce8ce). Would you consider updating the license for this parser to match?

If not please include a note in this issue, which would serve as a reference for future readers. ๐Ÿ‘

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.