Open odonyde opened 5 years ago
I'll see if there are some options available...
Thanks for having a look into this! I really like how your extension eliminates the distraction by markdown symbols and allows to entirely focus on the content.
I'm experimenting with an option to have unotes auto-reformat your markdown using remark-stringify. To enable this feature, add a 'remark_settings.json' file to the .unotes folder in your project directory. All remark-stringify options can be used.
listItemSpace
listItemTabSize
{
"gfm": true,
"commonmark": false,
"pedantic": false,
"looseTable": false,
"spacedTable": true,
"paddedTable": true,
"fence": "`",
"fences": true,
"bullet": "-",
"listItemIndent": "tab",
"listItemSpace": 1,
"listItemTabSize": 4,
"incrementListMarker": true,
"rule": "-",
"ruleRepetition": 3,
"ruleSpaces": false,
"strong": "*",
"emphasis": "_"
}
Please try it out and let me know if that works for you. It's kind of experimental and I haven't fully tested everything yet... Unotes-1.0.9.vsix.zip
Cool! Installing Unotes 1.0.9 and setting the following remark-stringify configuration solved my list item issue:
{
"bullet": "-",
"listItemIndent": "tab",
"listItemSpace": 1,
"listItemTabSize": 4
}
Unfortunately the new version also introduced two new formatting issues:
<https:\\example.com>
is converted into <https:\\example.com data-tomark-pass >
1.
is converted into 1\.
I tried several combinations of the gfm
, commonmark
, pedantic
, and entities
flags but the above mentioned replacements persisted.
Thanks for the feedback. There appear to be some side-effects as you discovered. I'll see if I can resolve those issues...
I added a fix for the angle bracket by having remark-stringify not create angle bracket links. I'm not able to reproduce the second issue (escaped numberings). What settings produced this?
Here is an updated version. Unotes-1.0.10.vsix.zip
Hi, Ryan! I did some testing with Unotes 1.0.10 and could delimit the escaped numberings issue: the conversion only happens for sublists with a preceding text paragraph. Example:
1. Item 1
Some text.
1. Item 1.1
Some text.
2. Item 1.2
Some text.
is converted into
1. Item 1
Some text.
1\. Item 1.1
Some text.
2\. Item 1.2
Some text.
This applies also for unordered sublists with a preceding text paragraph, only that here the hyphen gets converted into an underscore. Example:
- Item 1
Some text.
- Item 1.1
Some text.
- Item 1.2
Some text.
is converted into
- Item 1
Some text.
_ Item 1.1
Some text.
_ Item 1.2
Some text.
Regarding the angle bracket links issue: It still persists in version 1.0.10 for me and I observed that in fact any <
is converted into <
, independent if it is part of a link or used in a comparison (e.g. A < B
becomes A < B
).
@odonyde thanks for taking a look and giving me those examples. I removed all escape coding from the remark processing since I don't see the need for it. Let me know if this fixes the issue for you.
Hi, @ryanmcalister! I took a look at Unotes 1.0.11: the moment I open file Unotes-Test.md
with Unotes, it's content gets converted into the result you can see in Unotes-Test-Result-1-0-11.md
.
So version 1.0.11 resolves the escaping of <
for me while the other unwanted conversions still happen.
PS: I have meanwhile updated Visual Studio Code to version 1.36.1 and I deactivated all other extensions except Unotes for the testing workspace.
unotes 1.0.14 has a fix for the 'data-tomark-pass >' issue. The other list formatting issues I have looked into, unfortunately it's a combination of the tui-editor's output and the remark formatting logic. I haven't found a good solution yet. I may have to request some features from tui-editor...
Hi, @ryanmcalister! I can confirm that 1.0.14 fixes the data-tomark-pass >
issue and now correctly converts links in angle brackets notation into inline-style links. Unfortunately it also converts any reference-style links into inline-style links. Example: The reference-style link
[example.com][ref]
[ref]: https://example.com
is converted into the inline-style link
[example.com](https://example.com)
while it simply should remain unchanged (see also Unotes-Test-Result-1-0-14.md
in Unotes-Test-1-0-14.zip).
Regarding the sub-list item formatting issues: this is for sure a more complex one if it is caused by a combination of TUI Editor and remark-stringify. Although: in case TUI Editor
applies any formatting changes, I would regard this as a bug on their side as the markdown should be simply left unchanged.
@odonyde Thanks for checking it out. Just an update, Unotes 1.0.15 now has the original remark-stringify behavior which keeps links unchanged except in the case when the url matches the link text. In this case it will change the inline-style link to an angle bracket link.
I really like the idea of this extension but I am facing a blocker using it: UNotes doesn't respect our team's style guide which we enforce via Markdownlint. For example, we have configured Markdownlint to only allow dashes to indicate unordered list items (
"MD004": {"style": "dash"}
). But opening an existing markdown document, UNotes converts all existing list item dashes into asterisks and thus makes the document incompliant to our style guide.