-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Unable to control escaping of common characters such as '.' and '-' which destroys plain-text readability #47
Comments
Hi, I think it makes sense to create your own escaping rules if you want to. I don't think it makes sense to use 'no escape' everywhere. For example, you must escape '|' when you are inside a table. Regarding the setter for I prepared a draft PR with possible implementation of custom escaping rules. |
I had a go at this on my own while I was waiting for you to respond, in my own fork. I got something working where I added an Escaper property to the It seems like in cases where escaping is mandatory, for example URLs, the writer selects and uses an appropriate escaper already, so I am only setting the default to use when no escaper is required by the writer context. It works for my use-case but I haven't thought beyond that. I could make a pull request if you wanted, but not sure how much sense it would make because I also updated all my projects to support .netstandard2.0 and .net8.0 |
Oh, so you want change only default escaper - when there is no specific context. Got it.
PR is more than welcome. However, it would be better to not mix it changing target frameworks. |
I'm using
MarkdownWriter
to render markdown into a StringBuilder. Example code:The default escaper escapes common characters such as '.' and '-'. This destroys readability when viewing with a simple text editor such as Notepad. For example, consider this table of measurements:
vs. the unescaped version:
Having Markdown files readable as plain text with no special software was one of the attractions of using the format, so I need to not escape any characters at all (I'm careful about what I write so this will not be an issue in my use-case). I can see there is an escaper variant called
NoEscape
, which seems to be exactly what I need, however I cannot find any way to inject it into the settings. The only place I can see this being set is as a default value in MarkdownBaseWriter, and my IDE says theset
accessor is never used:Therefore, even though there are several escapers available, there seems to be no way to use anything but
MarkdownCharEscaper.Default
, which isDefaultMarkdownEscaper
, which is too aggressive.Would it be possible to be able to set the escaper, please? Possible via
MarkdownWriterSettings
?The text was updated successfully, but these errors were encountered: