Git Product home page Git Product logo

markdowndeep's People

Contributors

benswayne avatar buildstarted avatar eisenbergeffect avatar kerryjiang avatar redknightlois avatar toptensoftware 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

markdowndeep's Issues

Configure whitelist's

Hi,

We like to force our content authors to use markdown for stuff like bold, italics, lists, headers etc. So we basically want them to use plain markdown and no HTML at all.

To do so an easy approach would be to customize / configure the whitelist's of MarkdownDeep. We've checked the source code and saw that they are private static what makes them really closed. We didn't find an event/delegate/etc. to use and there is no virtual one can override or some sort of IoC.

Is there any way to customize/configure the whitelists?

If not that may be a really nice and little enhancement because the SafeMode feature is a key-feature why we selected MarkdownDeep.

Thanks for helping,
Marc

Support ` for fenced code blocks

It looks like markdowndeep treats ~ as the exclusive fenced code block character. It'd be nice to support ` as well.

```
one

two

three
```

Produces

"<p><code>one

two

three
</code></p>
<p>two</p>
<p>three
```</p>

Expected

"<p><code>one

two

three
</code></p>

security issue with javascript

Javascript can be executed by placing it into the URL parameter. This example will be parsed without any sanitation by markdowndeep:

javascript

Strong-sign the library

Would be quite convenient to have strong-signed assembly in the NuGet repository because otherwise in order to use in another strongly-signed assembly one have to download the source code and sign the library himself.

Allow extending resolution of link definitions

Would you support a pull request to mark the GetLinkDefinition function as virtual?

public LinkDefinition GetLinkDefinition(string id)
{
    LinkDefinition link;
    if (m_LinkDefinitions.TryGetValue(id, out link))
        return link;
    else
        return null;
}

I'd like to be able to allow my (internal) users to use a custom syntax for linking to database resources. I think that if it's done by extending the link definition resolution it may be useful to people more generally.

If so, does the project style prefer introducing a template method here so that all subclasses are required to prefer entries in the m_LinkDefinitions lookup to whatever their own virtual entries may be, or is just marking the whole thing virtual OK?

Add support for FormatCodeSpan, in the same way as FormatCodeBlock

FormatCodeBlock is awesome. It allows you to modify the HTML output to allow for syntax highlighting of the generated HTML.

It would be great to see the same functionality added to the TokenType.code_span in the SpanFormatter class!

I'd be more than happy to make this update and submit a pull request, if you agree this would be a worthwhile update to the library

Nested lists do not work

This construct doesn't work:

  1. List Item 1
    • List 2 - Item 1
    • List 2 - Item 2
  2. List Item 2

That's:

1. List Item 1
    - List 2
2. List Item 2

I am assuming other types of nested lists also are broken.

Error matching strong tags

Suppose we have a string without any spaces between words:

**A**And**B**AreAlmost**Aame**AsTheyAre**Not**ReallyDifferentCreatures.

For MarkdownDeep, it converts to a wrong HTML which is:

<p>
    <strong>A</strong>And<strong>B<strong>AreAlmost</strong>Aame</strong>AsTheyAre<strong>Not</strong>ReallyDifferentCreatures.
</p>

It seems MarkdownDeep matches the first ** and the last ones to create a <strong> tag, however the matching should be eager and the write output should be:

<p>
    <strong>A</strong>And<strong>B</strong>AreAlmost<strong>Aame</strong>AsTheyAre<strong>Not</strong>ReallyDifferentCreatures.
</p>

For many culture, they don't put any spaces between words, so I assume this is a fatal issue.

Nuget package directory organization

Hello,
the Nuget package is great, but is it possible to have it better organized? The scripts in the Scripts directory and css and images in the Content directory... I think this would make it a little better organized.

Thanks.

Several bold or italic words in parenthesis in a paragraph and markdowndeep is broken

Just try this:

orem ipsum dolor sit (amet), consectetur. Aliquam ut (tristique) porttitor. Fusce eget (purus) cursus.

It will rendre italic from tristique to purus. Same if this is bold. If I switch to markdownsharp, it renders well. This is a total dealbreaker since having several bold or italic words in a paragraph is a so basic requirement.

Thanks to check that.
Note: using nuget packages for both libraries.

[Question] How to make text italic before full stop

Formatting the last word of a sentence (e.g. making it italic) doesn't work.
I.e. "Hi there." is rendered as "Hi there." instead of "Hi there."
Is there another way to do it (without adding a space between _ and .)

Support GitHub Style Code Blocks

Markdowndeep and Github support indented blocks as <pre> or code blocks. Github also has the Syntax Highlighting format.

```ruby
require 'redcarpet' 
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
```

Which produces this,

require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html

MarkdownDeep doesn't need to do the syntax highlighting, but it should at least treat it like a code block.

Handling raw URLs

StackOverflow and other sites support handling raw URLs in the input and converting them to tags. Could this not be added as an option to markdowndeep too?

Incorrect Markup Generated for Footnotes

When html is generated for handling footnotes, the markup contains tags of the following form:

<li id="#fn:xxx" ...>

ie. the id attribute is prefixed with the # (hash/pound) symbol and this prevents the corresponding anchor tag from correctly linking to the footnote.

Is it possible to support auto-new-line?

I know that markdown renders the following as one line:

line1
line2

But this is really annoying to me. To me, if the user types a carriage return, it's because they want a new line. Can mdd support this, or is there a way I could implement it myself?

YouTube embedding doesn't work

This:

<iframe title="YouTube video player" width="480" height="390" src="some url" frameborder="0" allowfullscreen></iframe>

Does not work; I have SafeMode = false. It allows the end tag but encodes the <iframe tag.

If I take off allowfullscreen it then works. I think for some reason it's not allowing the HTML even though SafeMode is off.

render images with spaces in path

continuation of Code52/DownmarkerWPF#405

Please consider adding support for spaces in folder and filenames. My use case for example is storing images and figure in sub-folders of the working directory, an syncing it with colleagues that sometimes use Mac OS X. MacDown has no problem with spaces for example, so that renaming, copying and/or reordering the image files is not a feasible option.

doesnt-resolve-spaces-in-file-links

Audio HTML5 tag unsupported

Would you consider adding HTML5 tag support? I want to use audio and video tags.

Adjusting MarkdownInHtml nor SafeMode didn't make a difference.

Expected: <audio> tag to render, but got &lt; audio wrapped in a <p>.

Is there anything I could be doing differently?

audio tag not supported

Some text (Invalid HTML mistaken for HTML) causes exceptions

 System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at MarkdownDeep.HtmlTag.ParseHelper(StringScanner p) in Z:\markdowndeep\MarkdownDeep\HtmlTag.cs:line 343

MathJax and MarkdownDeep

Hello,

Is it possible to integrate MathJax with MarkdownDeep?

Something similar to what is used in StackExchange:
http://math.stackexchange.com/editing-help#latex

The Gamma function satisfying $\Gamma(n) = (n-1)!\quad\forall
n\in\mathbb N$ is via through the Euler integral

$$ \Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt,. $$

Thank You,
Miguel

Image links don't work

This won't work:

[![image alt](/Image/3)](www.google.com)

It produces a link to Google with the ![image](url)] syntax within it.

This is the only bug I've seen; can't use it until it gets fixed (I use a lot of thumbnails). I might take a look at the source to see if I can write a test and get it to pass if you can't get to it soon.

I have not tested other types of nested bracket syntax.

This is an awesome library; switched to it from MarkdownSharp.

First call fails

When I push our website to the live server, or when the app pool restarts, I get the following error once. If the server restarts, and then comes up again, I get this error until I bounce the app pools again.

Server Error in '/' Application.

Index was outside the bounds of the array.

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.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error:

Line 24:

@Html.ActionLink(discussion.Title.Display(), "Discussion", "Forums", new { id = discussion.ID }, null)


Line 25:
by @discussion.Author.DisplayName

Line 26: @Html.Raw(discussion.Text.DisplayMarkdown())
Line 27:
Line 28:

Source File: c:\inetpub\wwwroot\MyWeb\Views\Home\Index.cshtml Line: 26

Stack Trace:

IndexOutOfRangeException: Index was outside the bounds of the array.]
MarkdownDeep.Markdown.CreateBlock() +197
MarkdownDeep.BlockProcessor.EvaluateLine() +21
MarkdownDeep.BlockProcessor.ScanLines() +105
MarkdownDeep.Markdown.ProcessBlocks(String str) +171
MarkdownDeep.Markdown.Transform(String str, Dictionary'2& definitions) +30
NPCPortal.Utilities.StringHelpers.TransformMarkdown(String markdownText) +113
ASP._Page_Views_Home_Index_cshtml.Execute() in c:\inetpub\wwwroot\MyWeb\Views\Home\Index.cshtml:26
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +125
System.Web.WebPages.StartPage.ExecutePageHierarchy() +143
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +110
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +380
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList'1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +109
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList'1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +890
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList'1 filters, ActionResult actionResult) +97
System.Web.Mvc.Async.<>c__DisplayClass1e.b__1b(IAsyncResult asyncResult) +241
System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid'1.CallEndDelegate(IAsyncResult asyncResult) +111
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.WrappedAsyncVoid'1.CallEndDelegate(IAsyncResult asyncResult) +19
System.Web.Mvc.MvcHandler.b__4(IAsyncResult asyncResult, ProcessRequestState innerState) +51
System.Web.Mvc.Async.WrappedAsyncVoid'1.CallEndDelegate(IAsyncResult asyncResult) +111
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

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

Trailing spaces causes exception when plain-text transforming

When using plain-text transformations, trailing spaces seem to throw an exception. To fix this issue, we can trim the text before issuing the transform.

This throws the exception:

var markdownTransformer = new Markdown();
markdownTransformer.ExtraMode = true; 

markdownTransformer.SummaryLength = -1;
string html = markdownTransformer.Transform(text);

Trimming the text prevents the exception:

string html = markdownTransformer.Transform(text.Trim());

When is the NuGet package update expected?

Are there plans to update the NuGet package with recent fixes and improvements? In particular, #12 bites me from time to time. If this is not going to happen soon, it is all right, indeed. But this would be useful to know.

Thanks,
Roman

Shorcut problem in the editor

The shortcut code have a problem. I cant write @£$} on the editor. The reason is that on Swedish keyboard they are located on AltGr+2 3 4 0.
Altgr triggers key code 17 and 18. on of them is the same as ctrl and the format text is triggers and the character is not added to the field
I found the genererade key codes in FF and the same bug exist in Chrome and Edge on Windows 10.

The shortcut code had to be change to detect only a real ctrl key and not AltGr

Blockquotes newlines not respected

Consider this code

> line 1
> line 2

It renders as line 1 line 2 instead of

  line 1
  line 2

This is when using C# and the Transform(string) method

Multiple markdowndeep editors on the same page

Currently this is working however the preview pane is not, this is because of a bug in how getting the Preview div is handled.

It fails because it uses a global selector to retrieve the preview div. This is obviously done to maximise the flexibility one has as to where to display the preview div.

However its not very accommodating when you want to display multiple editors on the same page.

Cannot enter ">" on non english keyboard.

Some non-english keyboard maps ">" to altgr+Y. Because ctrl+y used by markdowndeep as the redo shortcut, and MarkdownDeepEditor.js has a bug, it is impossible to enter ">" on some non-english keyboards.

I've fixed it this way: change line 555 from
if( ( e.ctrlKey || e.metaKey )
to
if( ( e.ctrlKey || e.metaKey ) && !e.altKey )

mailto links don't work

It looks like normal markdown links with mailto don't work:

send me an email

is rendered literally, and not as a link. Is this the intended behavior, or a bug? And how could I implement a hook so this makes correct html links?

XSS

Vulnerable to XSS. try to write following text:
<scr<script>ipt>alert(document.cookie)</script>

List continuation problem

The second list is not numbered unless there's text between the lists.

- 1
- 2
- 3


0. a
0. b
0. c
- 1
- 2
- 3

o

0. a
0. b
0. c

PrepareImage doesn't allow for complex processing

For example, if I want to format an image with a litebox, there doesn't seem to be a way to wrap the img tag with a custom div or a tags

Changing the function signature from PrepareImage(HtmlTag, bool) to PrepareImage(ref HtmlTag, bool) should do the trick. Will it be safe to do that?

Link refs broken

I thought this might be related to #11 however it's not. There's just a bug in my integration with markdowndeep.

| should be escapable in table

| should be escapable in table.

Fix in TableSpec.cs:

// Find the next vertical bar
p.Mark();
while (!p.eol && p.current != '|')
    // p.SkipForward(1);      
    p.SkipEscapableChar(true); 

publish an npm package

I think you should publish the JavaScript side of MarkdownDeep as an npm package, preconfigured with CommonJS wirings. There are a few markdown libraries in the npm registry, but MarkdownDeep is the best, in my opinion. The "markdown" npm package has been hijacked by a markdown project that has annoyingly decided not to support inline HTML and providing another, more suitable option would be of great benefit to many, I'm sure.

"_test_," does not work in extra-mode

When extra mode is on, the following is not rendered in tags.

_test_,

Should char.IsWhiteSpace be replaced with something that also checks for comma, periods etc?

`this` context is wrong when used as EpicEditor parser

I am trying to use EpicEditor with MarkdownDeep as the parser like so:

var markdown = new MarkdownDeep.Markdown();
var editorOptions = {
    parser: markdown.Transform
}
var editor = new EpicEditor(editorOptions).load();

When EpicEditor invokes the markdown.Transform function, this is the context of the EpicEditor, not MarkdownDeep.Markdown resulting in the following error on line 145:

Uncaught TypeError: this.ProcessBlocks is not a function

See the following JSFiddle for an example: https://jsfiddle.net/1saet37v/

Transform() crashes on the piece of markdown

The following minimized piece of markdown makes Transform() to crash if ExtraMode && !SafeMode:

Term

: Definition

***

# Heading

Here is a PowerShell script ready to demonstrate the problem (replace the hardcoded DLL path with the actual):

Add-Type -Path C:\BIN\MarkdownDeep.dll

$markdown = New-Object MarkdownDeep.Markdown
$markdown.ExtraMode = $true
$markdown.SafeMode = $false

$text = @'

Term

: Definition

***

# Heading

'@

$markdown.Transform($text)

nuget-package

Will you publish a new nugetpackage with support for .NET core and/or .NET 4.6?

Extra empty paragraphs inserted into custom HTML

Example:

<figure>
  <img src="image.png" alt="Image" /> 
  <figcaption>Caption</figcaption>
</figure>

gets rendered as

<figure>
  <p></p>
  <img src="image.png" alt="Image" /> 
  <p></p>
  <figcaption>Caption</figcaption>
  <p></p>
</figure>

This happens even if MarkdownInHtml is false or ExtraMode is false. In other words, I always get these extra paragraphs.

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.