Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
00f9e98
-Split the Markdown Parser from MarkdownTextBlock.
WilliamABradley Nov 26, 2017
1e1600b
Made old MarkdownRenderedEventArgs obsolete.
WilliamABradley Nov 26, 2017
f68fec8
-Broke MarkdownTextBlock.cs into Categorised partial sections.
WilliamABradley Nov 26, 2017
75ff445
Fixed Header.
WilliamABradley Nov 26, 2017
900efc9
-Created MarkdownRendererBase from XamlRenderer, the initial cross pl…
WilliamABradley Nov 26, 2017
9650653
Renamed XamlRenderer to UWPMarkdownRenderer, as it doesn't Render any…
WilliamABradley Nov 26, 2017
432af33
-Made RenderBlocks virtual, it only gets overriden if it has to.
WilliamABradley Nov 26, 2017
b2d1385
Fixed missing Headers.
WilliamABradley Nov 26, 2017
2f34ae2
Added ICodeBlockResolver and CodeBlockResolving event, a way to injec…
WilliamABradley Nov 27, 2017
812e9e9
Fixed XML Comment, warned that Resolving events require Handled = true.
WilliamABradley Nov 27, 2017
c0aae98
-Restyled default MarkdownTextBlock brushes and layout, it is now mor…
WilliamABradley Nov 27, 2017
7d6140c
Moved BlockUIElementCollection object and InlineCollection ojbect ins…
WilliamABradley Nov 27, 2017
78bf888
-Added Automatic Markdown Code Block Syntax Highlighting!!! :) This w…
WilliamABradley Nov 28, 2017
7b5c53f
-Moved Markdown and RSS Parsers to new Microsoft.Toolkit.Parsers proj…
WilliamABradley Dec 5, 2017
f133914
Merge branch 'master' into MakeMarkdownUniversalAgain
WilliamABradley Dec 5, 2017
0ff9bc1
Fixed Namespace change issues.
WilliamABradley Dec 5, 2017
6dc2ccf
-Cleaned up a lot of Markdown documents to make them look better and …
WilliamABradley Dec 9, 2017
26f9f6c
Added License Header to ThemeListener
WilliamABradley Dec 9, 2017
c38d72c
-Updated CodeRenderer to use RichTextBlock and ColorCode-Universal, r…
WilliamABradley Dec 10, 2017
a848683
-Made MarkdownDocument more visible.
WilliamABradley Dec 10, 2017
4c88633
-Improved InitialContent.md for MarkdownTextBlock Sample.
WilliamABradley Dec 10, 2017
5ef17ca
Added Tooltips to Links.
WilliamABradley Dec 18, 2017
2248a43
-Added Property to Enable Code Block Text Wrapping.
WilliamABradley Dec 18, 2017
15dd257
Updated Documentation.
WilliamABradley Dec 18, 2017
816952b
Small Tweaks.
WilliamABradley Dec 18, 2017
aabec2e
ProcessDocs now handles Microsoft Note Notation.
WilliamABradley Dec 18, 2017
2cfa459
Updated Docs Metadata.
WilliamABradley Dec 18, 2017
2aecb67
Merge branch 'master' into MakeMarkdownUniversalAgain
WilliamABradley Jan 17, 2018
6b5b5a4
Fixed Unit Test Compile errors.
WilliamABradley Jan 17, 2018
d5ed7ae
-Made Common Internal, added externally used helpers to public static…
WilliamABradley Jan 17, 2018
b48b22c
-Added Obsoleted classes for Microsoft.Toolkit.Services, Microsoft.To…
WilliamABradley Jan 17, 2018
ba49e9c
-Made Markdown Blocks and Elements have a public constructor again, a…
WilliamABradley Jan 17, 2018
70ae74e
Removed all remaining dependencies from obsolete StringValueAttribute…
WilliamABradley Jan 17, 2018
8b934bf
Fixed VS warnings related to this PR.
WilliamABradley Jan 17, 2018
e5234e7
-Restuctured Markdown Parser folders and namespaces, now instead of M…
WilliamABradley Jan 17, 2018
ff71a18
Separated nested Classes and Enums to their own file.
WilliamABradley Jan 17, 2018
b8c3cb5
Fixed missing space.
WilliamABradley Jan 17, 2018
17500c9
Removed UWP Prefix from UWPMarkdownRenderer.
WilliamABradley Jan 17, 2018
3d0292b
Replaced ParseHelpers IsBlankOrWhitespace and IsWhiteSpace, with stri…
WilliamABradley Jan 19, 2018
77b35b4
Revert "Replaced ParseHelpers IsBlankOrWhitespace and IsWhiteSpace, w…
WilliamABradley Jan 19, 2018
6e5751b
Renamed ParseHelpers IsBlankOrWhiteSpace and IsWhiteSpace to IsMarkdo…
WilliamABradley Jan 19, 2018
5747f40
Fixed Access modifiers for RSS classes that don't need to be exposed.
WilliamABradley Jan 19, 2018
39cc0c4
Added Deprecation to Microsoft.Toolkit.Uwp.Services.Core.ExtensionMet…
WilliamABradley Jan 19, 2018
054f088
Added Documentation for Markdown Parser, added LinkClicked event to d…
WilliamABradley Jan 19, 2018
da59db2
-Added ThemeListener Documentation.
WilliamABradley Jan 19, 2018
1216f32
MarkdownTextBlock now will react to changes to RequestedTheme, as lon…
WilliamABradley Jan 19, 2018
caee71a
Improved Documentation.
WilliamABradley Jan 19, 2018
6271453
Added Basic Rss and Json Parser documentation.
WilliamABradley Jan 19, 2018
5a6c77e
Simplified Theme Checking.
WilliamABradley Jan 19, 2018
ef1ea23
-Added null checks to IRenderContext casting for UWP MarkdownRenderer…
WilliamABradley Jan 20, 2018
6562cf9
Add null check to MarkdownTextBlock RenderMarkdown, for Types that ar…
WilliamABradley Jan 20, 2018
3c3de6c
-Added Support for DocFX Notes in SampleAppMarkdownRenderer.
WilliamABradley Jan 20, 2018
9e1ace2
Added extra Null Check.
WilliamABradley Jan 20, 2018
2f4c55b
-Modified Sample.cs to only grab the latest copy only and cache in Re…
WilliamABradley Jan 20, 2018
e41e632
Fixed Documentation formatting issues related to Markdown correctness…
WilliamABradley Jan 20, 2018
fcb4b16
Fixed all but one pesky Unit Test.
WilliamABradley Jan 20, 2018
cb5c310
Fixed the last Pesky Unit Test.
WilliamABradley Jan 20, 2018
912b229
-Code Blocks now only semi-broken in ListBlock. Need to escape Tab ch…
WilliamABradley Jan 20, 2018
b346c6c
Fixed ListBlock swallowing any extra Whitespace.
WilliamABradley Jan 20, 2018
6b37dd4
-Restored Animation Docs to their former Glory, with more correct for…
WilliamABradley Jan 20, 2018
0c22cef
Made DocFX Notation formatting in line with docs.microsoft.com.
WilliamABradley Jan 20, 2018
612be34
Merge branch 'master' of https://github.com/Microsoft/UWPCommunityToo…
WilliamABradley Jan 23, 2018
524733a
Added Parser Documentation improvements.
WilliamABradley Jan 23, 2018
6ee4b01
-Added LinkReferenceInline in the Parser, a way to collect <a> HTML t…
WilliamABradley Jan 23, 2018
369ee04
Internalised JsonParser, I don't see it used anywhere, but it might b…
WilliamABradley Jan 24, 2018
7b40e2d
-Added better examples to RSS and Markdown Docs.
WilliamABradley Jan 24, 2018
18ab2ba
-Removed Comments from StaggeredPanel.
WilliamABradley Jan 24, 2018
ecf3644
Added Properties and Methods to RSSParser and MarkdownParser docs.
WilliamABradley Jan 24, 2018
689f817
Merge branch 'master' into MakeMarkdownUniversalAgain
WilliamABradley Jan 24, 2018
4448985
Fixed FrameworkElementExtensions docs.
WilliamABradley Jan 24, 2018
852ee7a
Merge branch 'master' of https://github.com/Microsoft/UWPCommunityToo…
WilliamABradley Jan 30, 2018
c1a65f0
-Fixed bug in BoldItalicTextInline.
WilliamABradley Jan 31, 2018
1d9ea98
Disabled the ThemeListener Sample for the time being.
WilliamABradley Jan 31, 2018
e194a21
Reverted most of the changes to the Animation Documentation.
WilliamABradley Feb 4, 2018
4d2ef94
Yet another fix for ListBlock logic.
WilliamABradley Feb 4, 2018
0b00a06
Fixed HamburgerMenu nav link.
WilliamABradley Feb 4, 2018
623479a
More Doc fixes.
WilliamABradley Feb 4, 2018
2d2bf1d
Fixed naming conventions and locations for Markdown Docs.
WilliamABradley Feb 6, 2018
b4b1dec
-Simplified SampleAppMarkdownRenderer structure, added extra comments…
WilliamABradley Feb 6, 2018
02155bd
Merge branch 'master' of https://github.com/Microsoft/UWPCommunityToo…
WilliamABradley Feb 6, 2018
8e320fa
Fixed VS complaints.
WilliamABradley Feb 7, 2018
d5911c4
Merge branch 'master' of https://github.com/Microsoft/UWPCommunityToo…
WilliamABradley Feb 10, 2018
dca5553
Renamed LinkReferenceInline to LinkAnchorInline, as it is a more fit…
WilliamABradley Feb 10, 2018
d078053
Fixed more VS complaints.
WilliamABradley Feb 10, 2018
3212cb6
Merged changes from UWPCommunityToolkit/Master into MakeMarkdownUnive…
WilliamABradley Feb 12, 2018
2c96d80
Merged UWPCommunityToolkit/Master into MakeMarkdownUniversalAgain.
WilliamABradley Feb 12, 2018
3137573
-Moved Extension methods to StringExtensions.
WilliamABradley Feb 13, 2018
929121e
Merge branch 'master' of https://github.com/Microsoft/UWPCommunityToo…
WilliamABradley Feb 13, 2018
36fb178
Fixed some more things.
WilliamABradley Feb 13, 2018
f4901eb
-Fixed naming and descriptions of StringExtensions.
WilliamABradley Feb 14, 2018
5faa708
-Added tests to MD test playlist.
WilliamABradley Feb 14, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Microsoft.Toolkit.Parsers/Core/IParser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE 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 CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using System.Collections.Generic;

namespace Microsoft.Toolkit.Parsers
{
/// <summary>
/// Parser interface.
/// </summary>
/// <typeparam name="T">Type to parse into.</typeparam>
public interface IParser<out T>
where T : SchemaBase
{
/// <summary>
/// Parse method which all classes must implement.
/// </summary>
/// <param name="data">Data to parse.</param>
/// <returns>Strong typed parsed data.</returns>
IEnumerable<T> Parse(string data);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,37 @@
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using System.Collections.Generic;
using System.Xml.Linq;

namespace Microsoft.Toolkit.Uwp.Services.Rss
namespace Microsoft.Toolkit.Parsers.Core
{
/// <summary>
/// RssParser.
/// This class offers helpers for Parsing.
/// </summary>
internal class RssParser : IParser<RssSchema>
public static class ParseHelpers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this class is only public just so this method can be used in in the controls project. And it seems like string.IsNullOrWhitespace could be just as easily used.

Copy link
Contributor Author

@WilliamABradley WilliamABradley Jan 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This checks for tabs as whitespace as well, which I am not sure is done by the string.IsNullOrWhitespace method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string.IsNullOrWhiteSpace also checks for tab

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, weird, I looked as mscorlib with dotPeek, and it looks like it does check for tab chars, I wonder why this was duplicated? @paulbartrum be advised if you implemented this, will this break anything?

Copy link

@paulbartrum paulbartrum Jan 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The markdown spec says:
A whitespace character is a space (U+0020), tab (U+0009), newline (U+000A), line tabulation (U+000B), form feed (U+000C), or carriage return (U+000D).

char.IsWhiteSpace() matches many many, more characters than just those six.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My two cents: these methods are implementation details of the markdown parser, they should be internal if possible (even if the parser itself is public).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Render.MarkdownRenderer has a dependency on IsBlankOrWhiteSpace, which is the reason it is public.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the change in 6e5751b makes it viable to keep it public.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why the renderer would need access to the parser helpers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used in a workaround for UWP, other use cases might need this function.

{
/// <summary>
/// Parse string to strong type.
/// Determines if a Markdown string is blank or comprised entirely of whitespace characters.
/// </summary>
/// <param name="data">Input string.</param>
/// <returns>Strong type.</returns>
public IEnumerable<RssSchema> Parse(string data)
/// <returns>true if blank or white space</returns>
public static bool IsMarkdownBlankOrWhiteSpace(string str)
{
if (string.IsNullOrEmpty(data))
for (int i = 0; i < str.Length; i++)
{
return null;
if (!IsMarkdownWhiteSpace(str[i]))
{
return false;
}
}

var doc = XDocument.Parse(data);
var type = BaseRssParser.GetFeedType(doc);

BaseRssParser rssParser;
if (type == RssType.Rss)
{
rssParser = new Rss2Parser();
}
else
{
rssParser = new AtomParser();
}
return true;
}

return rssParser.LoadFeed(doc);
/// <summary>
/// Determines if a character is a Markdown whitespace character.
/// </summary>
/// <returns>true if is white space</returns>
public static bool IsMarkdownWhiteSpace(char c)
{
return c == ' ' || c == '\t' || c == '\r' || c == '\n';
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using Windows.UI.Xaml.Documents;

namespace Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Display
namespace Microsoft.Toolkit.Parsers
{
/// <summary>
/// An internal interface used to handle links in the markdown.
/// Strong typed schema base class.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be handy to have more details here on what this is used for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used by the RSS Parser, and some of the Services like Bing? It is a base class for Schema based parsers.

/// </summary>
internal interface ILinkRegister
public abstract class SchemaBase
{
void RegisterNewHyperLink(Hyperlink newHyperlink, string linkUrl);
/// <summary>
/// Gets or sets identifier for strong typed record.
/// </summary>
public string InternalID { get; set; }
}
}
}
38 changes: 38 additions & 0 deletions Microsoft.Toolkit.Parsers/Core/StringValueAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE 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 CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using System;

namespace Microsoft.Toolkit.Parsers.Core
{
/// <summary>
/// The StringValue attribute is used as a helper to decorate enum values with string representations.
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public sealed class StringValueAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="StringValueAttribute"/> class.
/// Constructor accepting string value.
/// </summary>
/// <param name="value">String value</param>
public StringValueAttribute(string value)
{
Value = value;
}

/// <summary>
/// Gets property for string value.
/// </summary>
public string Value { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
// ******************************************************************

using System.Text;
using Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Helpers;
using Microsoft.Toolkit.Parsers.Markdown.Enums;
using Microsoft.Toolkit.Parsers.Markdown.Helpers;

namespace Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Parse
namespace Microsoft.Toolkit.Parsers.Markdown.Blocks
{
/// <summary>
/// Represents a block of text that is displayed in a fixed-width font. Inline elements and
/// escape sequences are ignored inside the code block.
/// </summary>
internal class CodeBlock : MarkdownBlock
public class CodeBlock : MarkdownBlock
{
/// <summary>
/// Initializes a new instance of the <see cref="CodeBlock"/> class.
Expand All @@ -34,6 +35,13 @@ public CodeBlock()
/// </summary>
public string Text { get; set; }

/// <summary>
/// Gets or sets the Language specified in prefix, e.g. ```c# (Github Style Parsing).<para/>
/// This does not guarantee that the Code Block has a language, or no language, some valid code might not have been prefixed, and this will still return null. <para/>
/// To ensure all Code is Highlighted (If desired), you might have to determine the language from the provided string, such as looking for key words.
/// </summary>
public string CodeLanguage { get; set; }

/// <summary>
/// Parses a code block.
/// </summary>
Expand All @@ -48,6 +56,7 @@ internal static CodeBlock Parse(string markdown, int start, int maxEnd, int quot
StringBuilder code = null;
actualEnd = start;
bool insideCodeBlock = false;
string codeLanguage = string.Empty;

/*
Two options here:
Expand Down Expand Up @@ -84,6 +93,15 @@ Or the code block starts and ends with ```
actualEnd = lineInfo.StartOfNextLine;
break;
}
else
{
// Collects the Programming Language from the end of the starting ticks.
while (pos < lineInfo.EndOfLine)
{
codeLanguage += markdown[pos];
pos++;
}
}
}
}

Expand Down Expand Up @@ -168,7 +186,11 @@ Or the code block starts and ends with ```
}

// Blank lines should be trimmed from the start and end.
return new CodeBlock() { Text = code.ToString().Trim('\r', '\n') };
return new CodeBlock()
{
Text = code.ToString().Trim('\r', '\n'),
CodeLanguage = !string.IsNullOrWhiteSpace(codeLanguage) ? codeLanguage.Trim() : null
};
}

/// <summary>
Expand All @@ -180,4 +202,4 @@ public override string ToString()
return Text;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@

using System;
using System.Collections.Generic;
using Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Helpers;
using Microsoft.Toolkit.Parsers.Markdown.Enums;
using Microsoft.Toolkit.Parsers.Markdown.Helpers;
using Microsoft.Toolkit.Parsers.Markdown.Inlines;

namespace Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Parse
namespace Microsoft.Toolkit.Parsers.Markdown.Blocks
{
/// <summary>
/// Represents a heading.
/// </summary>
internal class HeaderBlock : MarkdownBlock
public class HeaderBlock : MarkdownBlock
{
/// <summary>
/// Initializes a new instance of the <see cref="HeaderBlock"/> class.
Expand Down Expand Up @@ -170,4 +172,4 @@ public override string ToString()
return string.Join(string.Empty, Inlines);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Helpers;
using Microsoft.Toolkit.Parsers.Core;
using Microsoft.Toolkit.Parsers.Markdown.Enums;

namespace Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Parse
namespace Microsoft.Toolkit.Parsers.Markdown.Blocks
{
/// <summary>
/// Represents a horizontal line.
/// </summary>
internal class HorizontalRuleBlock : MarkdownBlock
public class HorizontalRuleBlock : MarkdownBlock
{
/// <summary>
/// Initializes a new instance of the <see cref="HorizontalRuleBlock"/> class.
Expand Down Expand Up @@ -60,7 +61,7 @@ internal static HorizontalRuleBlock Parse(string markdown, int start, int end)
{
break;
}
else if (!Common.IsWhiteSpace(c))
else if (!ParseHelpers.IsMarkdownWhiteSpace(c))
{
return null;
}
Expand All @@ -79,4 +80,4 @@ public override string ToString()
return "---";
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Helpers;
using Microsoft.Toolkit.Parsers.Core;
using Microsoft.Toolkit.Parsers.Markdown.Enums;
using Microsoft.Toolkit.Parsers.Markdown.Inlines;

namespace Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Parse
namespace Microsoft.Toolkit.Parsers.Markdown.Blocks
{
/// <summary>
/// Represents the target of a reference ([ref][]).
/// </summary>
internal class LinkReferenceBlock : MarkdownBlock
public class LinkReferenceBlock : MarkdownBlock
{
/// <summary>
/// Initializes a new instance of the <see cref="LinkReferenceBlock"/> class.
Expand Down Expand Up @@ -86,7 +88,7 @@ internal static LinkReferenceBlock Parse(string markdown, int start, int end)

// Skip whitespace
pos++;
while (pos < end && Common.IsWhiteSpace(markdown[pos]))
while (pos < end && ParseHelpers.IsMarkdownWhiteSpace(markdown[pos]))
{
pos++;
}
Expand All @@ -98,7 +100,7 @@ internal static LinkReferenceBlock Parse(string markdown, int start, int end)

// Extract the URL.
int urlStart = pos;
while (pos < end && !Common.IsWhiteSpace(markdown[pos]))
while (pos < end && !ParseHelpers.IsMarkdownWhiteSpace(markdown[pos]))
{
pos++;
}
Expand All @@ -110,7 +112,7 @@ internal static LinkReferenceBlock Parse(string markdown, int start, int end)

// Skip whitespace.
pos++;
while (pos < end && Common.IsWhiteSpace(markdown[pos]))
while (pos < end && ParseHelpers.IsMarkdownWhiteSpace(markdown[pos]))
{
pos++;
}
Expand All @@ -125,10 +127,12 @@ internal static LinkReferenceBlock Parse(string markdown, int start, int end)
case '(':
tooltipEndChar = ')';
break;

case '"':
case '\'':
tooltipEndChar = markdown[pos];
break;

default:
return null;
}
Expand All @@ -149,7 +153,7 @@ internal static LinkReferenceBlock Parse(string markdown, int start, int end)

// Check there isn't any trailing text.
pos++;
while (pos < end && Common.IsWhiteSpace(markdown[pos]))
while (pos < end && ParseHelpers.IsMarkdownWhiteSpace(markdown[pos]))
{
pos++;
}
Expand Down Expand Up @@ -177,4 +181,4 @@ public override string ToString()
return string.Format("[{0}]: {1} {2}", Id, Url, Tooltip);
}
}
}
}
Loading