Skip to content

Conversation

@josefpihrt
Copy link
Owner

@josefpihrt josefpihrt commented Nov 22, 2024

fixes #47

@josefpihrt josefpihrt self-assigned this Nov 22, 2024
Copy link

@NameOfTheDragon NameOfTheDragon left a comment

Choose a reason for hiding this comment

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

I have implemented a custom escaper as attached below, and verified that this does meet my needs. If you merge this change, then I'll delete my own fork and nuget package and just use this one.

    public class NoDecimalEscaperProvider : IMarkdownEscaperProvider
    {
        public MarkdownCharEscaper GetDefaultEscaper() => new NoDecimalPointEscaper();
    }

    public class NoDecimalPointEscaper : MarkdownCharEscaper
    {
        public override bool ShouldBeEscaped(char value)
        {
            if (value == '.')
                return false;

            switch (value)
            {
                case '|':
                case '`':
                case '\\':
                case '*':
                case '_':
                case '{':
                case '}':
                case '[':
                case ']':
                case '(':
                case ')':
                case '#':
                case '+':
                case '-':
                case '!':
                case '>':
                case '~':
                case '=':
                case '<':
                case '^':
                case ':':
                case '"':
                    return true;
                default:
                    return false;
            }
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to control escaping of common characters such as '.' and '-' which destroys plain-text readability

3 participants