Comments (4)
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.
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.
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.
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.
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)
- NotOwner not raised when user isnt owner HOT 2
- jsk ast fails with an error in certain cases HOT 2
- ability to add user who can run jishaku on the fly HOT 2
- Button disable
- Add Whois command HOT 2
- Unsupport discord.py v1.7.x HOT 1
- Python 3.9.13 not supported HOT 1
- Proper user configurable jsk py dict vars HOT 1
- change jishaku commands names HOT 1
- Jishaku version occasionally appears as vNone in selftest HOT 4
- Adding asqlite to options for the sql features HOT 3
- Unhandled code branch in `jishaku voice` command.
- Cog already loaded when loading it HOT 1
- I canβt use jishaku shell command HOT 2
- `jishaku timeit` raises an AttributeError upon use. HOT 1
- Tracking: need for a new release
- KeyError on Python version 3.11.0 HOT 3
- AttributeError: 'Context' object has no attribute 'add_reaction' HOT 2
- Question about next possible release to pypi HOT 2
- Convert message links to Message objects in REPLs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jishaku.