25 changed files with 2593 additions and 221 deletions
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace MarkdownSharp |
|||
{ |
|||
|
|||
internal class Demo |
|||
{ |
|||
|
|||
public static string ToHtml(string markdown) |
|||
{ |
|||
var processor = new Markdown(); |
|||
var html = processor.Transform(markdown); |
|||
return html; |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,84 @@ |
|||
/* |
|||
* MarkdownSharp |
|||
* ------------- |
|||
* a C# Markdown processors |
|||
* |
|||
* Markdown is a text-to-HTML conversion tool for web writers |
|||
* Copyright (c) 2004 John Gruber |
|||
* https://daringfireball.net/projects/markdown/
|
|||
* |
|||
* Markdown.NET |
|||
* Copyright (c) 2004-2009 Milan Negovan |
|||
* https://www.aspnetresources.com
|
|||
* https://aspnetresources.com/blog/markdown_announced.aspx
|
|||
* |
|||
* MarkdownSharp |
|||
* Copyright (c) 2009-2011 Jeff Atwood |
|||
* https://stackoverflow.com
|
|||
* https://blog.codinghorror.com
|
|||
* https://github.com/StackExchange/MarkdownSharp
|
|||
* |
|||
* History: Milan ported the Markdown processor to C#. He granted license to me so I can open source it |
|||
* and let the community contribute to and improve MarkdownSharp. |
|||
* |
|||
*/ |
|||
|
|||
#region Copyright and license
|
|||
|
|||
/* |
|||
|
|||
Copyright (c) 2009 - 2010 Jeff Atwood |
|||
|
|||
http://www.opensource.org/licenses/mit-license.php
|
|||
|
|||
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: |
|||
|
|||
The above copyright notice and this permission notice shall be included in |
|||
all copies or substantial portions of the Software. |
|||
|
|||
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. |
|||
|
|||
Copyright (c) 2003-2004 John Gruber |
|||
<http://daringfireball.net/>
|
|||
All rights reserved. |
|||
|
|||
Redistribution and use in source and binary forms, with or without |
|||
modification, are permitted provided that the following conditions are |
|||
met: |
|||
|
|||
* Redistributions of source code must retain the above copyright notice, |
|||
this list of conditions and the following disclaimer. |
|||
|
|||
* Redistributions in binary form must reproduce the above copyright |
|||
notice, this list of conditions and the following disclaimer in the |
|||
documentation and/or other materials provided with the distribution. |
|||
|
|||
* Neither the name "Markdown" nor the names of its contributors may |
|||
be used to endorse or promote products derived from this software |
|||
without specific prior written permission. |
|||
|
|||
This software is provided by the copyright holders and contributors "as
|
|||
is" and any express or implied warranties, including, but not limited
|
|||
to, the implied warranties of merchantability and fitness for a |
|||
particular purpose are disclaimed. In no event shall the copyright owner |
|||
or contributors be liable for any direct, indirect, incidental, special, |
|||
exemplary, or consequential damages (including, but not limited to, |
|||
procurement of substitute goods or services; loss of use, data, or |
|||
profits; or business interruption) however caused and on any theory of |
|||
liability, whether in contract, strict liability, or tort (including |
|||
negligence or otherwise) arising in any way out of the use of this |
|||
software, even if advised of the possibility of such damage. |
|||
*/ |
|||
|
|||
#endregion
|
File diff suppressed because it is too large
@ -0,0 +1,45 @@ |
|||
namespace MarkdownSharp |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// Options for configuring MarkdownSharp.
|
|||
/// </summary>
|
|||
internal class MarkdownOptions |
|||
{ |
|||
/// <summary>
|
|||
/// when true, (most) bare plain URLs are auto-hyperlinked
|
|||
/// WARNING: this is a significant deviation from the markdown spec
|
|||
/// </summary>
|
|||
public bool AutoHyperlink { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// when true, RETURN becomes a literal newline
|
|||
/// WARNING: this is a significant deviation from the markdown spec
|
|||
/// </summary>
|
|||
public bool AutoNewlines { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// use ">" for HTML output, or " />" for XHTML output
|
|||
/// </summary>
|
|||
public string EmptyElementSuffix { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// when false, email addresses will never be auto-linked
|
|||
/// WARNING: this is a significant deviation from the markdown spec
|
|||
/// </summary>
|
|||
public bool LinkEmails { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// when true, bold and italic require non-word characters on either side
|
|||
/// WARNING: this is a significant deviation from the markdown spec
|
|||
/// </summary>
|
|||
public bool StrictBoldItalic { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// when true, asterisks may be used for intraword emphasis
|
|||
/// this does nothing if StrictBoldItalic is false
|
|||
/// </summary>
|
|||
public bool AsteriskIntraWordEmphasis { get; set; } |
|||
} |
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace MarkdownSharp |
|||
{ |
|||
|
|||
internal enum TokenType |
|||
{ |
|||
Text, |
|||
Tag |
|||
} |
|||
|
|||
internal struct Token |
|||
{ |
|||
|
|||
public Token(TokenType type, string value) |
|||
{ |
|||
Type = type; |
|||
Value = value; |
|||
} |
|||
|
|||
public TokenType Type; |
|||
public string Value; |
|||
|
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue