-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for GitHub style tables #111
base: master
Are you sure you want to change the base?
Conversation
Thank you! I will review as soon as I can find enough free time. The worst case scenario ir right after Easter when I have some free days though I hope to do so sooner. |
No problem if you don't have time in a while, gives me time to correct some failing tests regarding https://github.github.com/gfm/#tables-extension- and the examples there. |
@Knagis i have implemented GFM:s task lists (https://github.github.com/gfm/#task-list-items-extension-), should i merge those changed to this PR or should i make a new PR for that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I finished reviewing the code. There are few files that should be reformatted so that it does not show every line as a change. Other than that the one big problem is relying on StringPart representing a whole line - which is not a guarantee.
CommonMarkConverter.ProcessStage3(ast, str, WriteSettings); | ||
html = str.ToString(); | ||
} | ||
Assert.AreEqual("<table><thead><tr><th>First Header</th><th>Second Header</th></tr></thead><tbody><tr><td>Content Cell</td><td>Content Cell</td></tr><tr><td>Content Cell</td><td>Content Cell</td></tr></tbody></table>", html); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it would be better if every would be followed by a newline? Perhaps even each cell?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is according to the GHFM-specs, i think its better to leave it as is to have it the same as the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, agree
/// The parser will recognize syntax <c>[foo]</c>, which will be encoded in a separate AST node that the host application may evaluate as desired. | ||
/// <summary> | ||
/// The parser will recognize syntax <c>[foo]</c>, which will be encoded in a separate AST node that the host application may evaluate as desired. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect indent
/// | ||
/// Refer to https://help.github.com/articles/organizing-information-with-tables/ for more examples | ||
/// </summary> | ||
GithubStyleTables = 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub
- capital "H"
/// <summary> | ||
/// The parser will recognize | ||
/// | ||
/// First Header | Second Header |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add <code>
around the example (I suppose that is the correct tag as otherwise the intellisense could format the example).
@@ -0,0 +1,48 @@ | |||
using System; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file should be deleted
private static void MakeCell(string text, Block row, ref int offset) | ||
{ | ||
int length = text.Length; | ||
string trimmedText = text.TrimStart(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a new string copy trimmedText
should not be created - instead the whitespaces should be counted within the text
and then the StringContent created from the text
instance.
Though as before, it could be left as a //TODO:
continue; | ||
|
||
var lineLength = line.Length; | ||
string actualLine = line.Source.Substring(line.StartIndex, line.Length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not create the string copy actualLine
, instead use the string part as is.
{ | ||
if ((settings.AdditionalFeatures & CommonMarkAdditionalFeatures.GithubStyleTables) == 0) return false; | ||
|
||
var parts = b.StringContent.RetrieveParts().Array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the RetrieveParts()
do not guarantee that they will be split on the line. A single part could contain multiple lines and also a single line could consist of multiple parts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give me an example of when a line would be multiple parts?
@@ -0,0 +1,234 @@ | |||
using System; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this file
|
||
System.Diagnostics.Debug.WriteLine(message, "Warning"); | ||
} | ||
/// <summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please reformat using 4 space indent
What is the status of this? Does CommonMark.NET support tables yet? |
Due to my current family situation i havent had the time to finish this. I
hope to be able to do it during the fall.
På 18 oktober 2017 7:44:24 em Jake Burgy <[email protected]> skrev:
… What is the status of this? Does CommonMark.NET support tables yet?
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#111 (comment)
|
Hi,
I took the code from #90 and tried to fix your comments.
Would close #42.
/ekblom