Giter VIP home page Giter VIP logo

Comments (4)

Gorialis avatar Gorialis commented on June 19, 2024 1

Discord recently added an interactive, syntax highlighted, file preview feature on the desktop and web clients.

As this is the most common usage vector for Jishaku, and the intuitiveness greatly exceeds home-rolled solutions, as of 9099fe0, Jishaku will now check the file upload limit and, if the source file content fits within it, will upload the content as a file instead.

image

This circumvents the need for escaping in this case, but in the case it does not fit, the handling has been changed to favor @iomintz 's implementation.

from jishaku.

ioistired avatar ioistired commented on June 19, 2024

I started implementing this by just making the jsk_source command replace all occurrences of ``` with ``\N{zero width space}`, but then I noticed that since FilePaginator also uses WrappedPaginator with a fenced code block, it might be better to place this escaping code inside a new commands.Paginator subclass that's used as the base for all other base Paginator classes. Something like this:

def __init__(self, ...):
    self.escape_code_blocks = False
    if '```' in prefix and '```' in suffix:
        self.escape_code_blocks = True

def add_line(self, line):
    if self.escape_code_blocks:
        line = line.replace('```', '``\N{zero width space}`')
        super().add_line(line)

Let me know what you think @Gorialis

from jishaku.

bhagyajbijukumar avatar bhagyajbijukumar commented on June 19, 2024

i have earlier used discord.utils.escape_markdown from the discordpy library in my project isn't it possible to use that function?

from jishaku.

Gorialis avatar Gorialis commented on June 19, 2024

I merged #92 a while ago, but I realized in auditing later that it actually produces a lot of formatting inconsistencies (all underscores get "escaped"). I'll probably end up favoring this implementation, but we'll see how it goes when I have time to do some proper QA.

from jishaku.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.