Comments (7)
Good suggestion, I'm currently kinda busy, but I'll take a look ASAP, it will be free until then! ❤️
from mdbook-emojicodes.
No worries! Take your time!
from mdbook-emojicodes.
btw, feel free to ignore the comment if you are busy. I'm just curious.
I see you've added a "good first issue" label. I'm fairly new to mdbook
so I don't know how you might go about handling this. But if you were to give me some direction, I'm happy to submit a PR.
I assumed you would have to pull in a dependency like pulldown_mark
to figure out whether you are in a codeblock or not, and decide whether to parse based on that. Do you have a simpler approach in mind?
from mdbook-emojicodes.
We can use the pulldown_cmark
crate (preferably the same version that mdbook
uses) but that would slow down generation. An additional regex could be added for detecting pairs of codefences (```), and checking if the current match character position is in between one of those pairs would be pretty easy. It would also check that the type is "markdown" or "md". If you're experienced with Rust, it should be kinda easy.
If you don't feel comfortable trying this out, always feel free to say so! Solving this issue isn't a compromise 😅 and I'm always willing to help here.
from mdbook-emojicodes.
I’m fairly comfortable in Rust! So I wouldn’t mind giving it a shot. I did go through the code and figured I could easily do it by splitting the content on triple backticks that start at the beginning of a line, and only splitting the logic to every alternate chunk.
I think there are some corner cases though. If someone has a quadruple back tick that wouldn’t work.
I guess I can special case for that and call it good enough? What do you think?
from mdbook-emojicodes.
Yeah it's probably good enough, we can use some regex syntax to account for four or more backticks. Even then, it's a very uncommon case so I think it's good enough 👍
from mdbook-emojicodes.
I made a PR for this. It handles code blocks correctly imo, but does not handle admonish
codeblocks. I added a test showing what it does for admonish blocks (i.e. the same as normal codeblocks).
from mdbook-emojicodes.
Related Issues (6)
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 mdbook-emojicodes.