-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
Markdown improvements regarding tables, nested statements and special character support in links #1647
base: main
Are you sure you want to change the base?
Conversation
squased Markdown commits Revert "squased Markdown commits" This reverts commit 615c88d. removed spaces Update InsertBoxCommand.cs merged input squased Markdown commits squased Markdown commits Revert "squased Markdown commits" This reverts commit 615c88d. removed spaces Update InsertBoxCommand.cs merged input Revert "Merge branch 'improveMarkdown' of github.com:weissm/OneMore into improveMarkdown" This reverts commit c296f72. Merge branch 'improveMarkdown' of github.com:weissm/OneMore into improveMarkdown Revert "squased Markdown commits" This reverts commit 93411d9. Revert "Added nested table example" This reverts commit d5d0122. Added nested table example Added nested table example
* Remove call to SwithToThisWindow stevencohn#1652 * v6.6.1
* Fix spacing stevencohn#1655 * lines * lines
I will take a look at this. Just need a little time. Thanks! |
@weissm Using your Nested Tables example page, this results in markdown as follows, with a table header divider line after the table, not before: | **🛈** | **Test Protocol** Markdown generation of nested tables <ol><li>Here is a nested table</li><li>Export this to an Markdown file or Copy as Markdown</li><li>Confirm that a netsted table is generate</li></ol> | | |
| :--- | :--- | :--- | :--- | and when converted back to OneNote content, looks like this: The divider line should be removed, or before the table and translated to an actual divider |
|
||
public PrefixClass(string set_indents = "", string set_tags = "", string set_bullets = "", string tablelistid = "") |
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.
Remove the set_
prefix on these parameter names.
Use a default constructor to take advantage of the field default values above, otherwise the default parameter values are redundant here.
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.
set_ removed. The default parameters I left equal to allow instantiation with detault parameters.
break; | ||
|
||
case "T": | ||
{ | ||
var context = DetectQuickStyle(element); | ||
if (context is not null) | ||
if (contained) // not in table 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.
You've lost calls to DetectQuickStyle and Stylize here; OneNote can add quickStyleIndex to T, OE, OEChildren - one or any of them.
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.
Added DetectQuickStyle again. Let it out as I did not see this actually been used in OneNote so far.
} | ||
|
||
if (index >= 0) | ||
if (element.GetAttributeValue("quickStyleIndex", out int index)) |
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 code as-is, only detects quick style on OE. It's missing detection on OEChildren and T. That why the deleted code look at parent elements until it found a quickStyleIndex. Text may not be styled correctly.
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 intention here was to have the check only in the current level for both OE and T as in the intially code. The recursive nature did not work here and it should not be needed, as it is handled at each stage already.
|
||
switch (symbol) | ||
{ | ||
case 3: // to do | ||
case 8: // client request | ||
case 12: // schedule/callback | ||
case 28: // to do prio 1 | ||
case 71: // to do prio 2 | ||
case 28: // todo prio 1 |
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.
OneNote calls them "To do" tags, not "Todo" tags
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.
done
case 64: retValue = (":star: "); break; // custom 1 | ||
case 70: retValue = (":one: "); break; // one | ||
case 116: retValue = (":busts_in_silhouette: "); break; // busts_in_silhouette | ||
case 117: retValue = (":notebook: "); break; // notebook |
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.
117 is a bell, not a notebook
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.
done
case 70: retValue = (":one: "); break; // one | ||
case 116: retValue = (":busts_in_silhouette: "); break; // busts_in_silhouette | ||
case 117: retValue = (":notebook: "); break; // notebook | ||
case 118: retValue = (":mailbox: "); break; // contact |
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.
118 is a letter, not a mailbox
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.
done.
while (nestedtables.Count() != 0) | ||
{ | ||
var nestedtable = nestedtables.First(); | ||
writer.WriteLine(prefix.indents + "<details id=\"nested-table" + nestedtable.index + "\" open>"); |
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.
Shouldn't <details>
have a closure </details>
?
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.
good catch. Added closing and additional
pair to allow collapse tables.
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.
Worked in changes as suggested.
while (nestedtables.Count() != 0) | ||
{ | ||
var nestedtable = nestedtables.First(); | ||
writer.WriteLine(prefix.indents + "<details id=\"nested-table" + nestedtable.index + "\" open>"); |
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.
good catch. Added closing and additional
pair to allow collapse tables.
case 70: retValue = (":one: "); break; // one | ||
case 116: retValue = (":busts_in_silhouette: "); break; // busts_in_silhouette | ||
case 117: retValue = (":notebook: "); break; // notebook | ||
case 118: retValue = (":mailbox: "); break; // contact |
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.
done.
case 64: retValue = (":star: "); break; // custom 1 | ||
case 70: retValue = (":one: "); break; // one | ||
case 116: retValue = (":busts_in_silhouette: "); break; // busts_in_silhouette | ||
case 117: retValue = (":notebook: "); break; // notebook |
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.
done
|
||
switch (symbol) | ||
{ | ||
case 3: // to do | ||
case 8: // client request | ||
case 12: // schedule/callback | ||
case 28: // to do prio 1 | ||
case 71: // to do prio 2 | ||
case 28: // todo prio 1 |
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.
done
} | ||
|
||
prefix.bullets = ""; |
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.
done
break; | ||
|
||
case "T": | ||
{ | ||
var context = DetectQuickStyle(element); | ||
if (context is not null) | ||
if (contained) // not in table 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.
Added DetectQuickStyle again. Let it out as I did not see this actually been used in OneNote so far.
|
||
public PrefixClass(string set_indents = "", string set_tags = "", string set_bullets = "", string tablelistid = "") |
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.
set_ removed. The default parameters I left equal to allow instantiation with detault parameters.
} | ||
|
||
if (index >= 0) | ||
if (element.GetAttributeValue("quickStyleIndex", out int index)) |
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 intention here was to have the check only in the current level for both OE and T as in the intially code. The recursive nature did not work here and it should not be needed, as it is handled at each stage already.
squased Markdown commits Revert "squased Markdown commits" This reverts commit 615c88d. removed spaces Update InsertBoxCommand.cs merged input squased Markdown commits squased Markdown commits Revert "squased Markdown commits" This reverts commit 615c88d. removed spaces Update InsertBoxCommand.cs merged input Revert "Merge branch 'improveMarkdown' of github.com:weissm/OneMore into improveMarkdown" This reverts commit c296f72. Merge branch 'improveMarkdown' of github.com:weissm/OneMore into improveMarkdown Revert "squased Markdown commits" This reverts commit 93411d9. Revert "Added nested table example" This reverts commit d5d0122. Added nested table example Added nested table example
…e into improveMarkdownPullRequest
@weissm This PR is now far beyond the original intent described by the title. I cannot accept this as a single PR. |
Understood. This PR extension was meant to address: Will create separate PRs to ease handling. |
IS YOUR COMMIT SIGNED?
yes
Enhancement or Defect Addressed by This PR
Enhancement
Description of Proposed Changes
When generating markdown nested tables the handled was not done properly. Also the handling of numbered list in tables was not properly processed.
The following changes are applied:
<>
. To protect these characters, theReplace
statement is moved before.The push requested was tested on the OneNote TextToTable. For clarification another example onenote page NestedTableContent is added.