-
Notifications
You must be signed in to change notification settings - Fork 258
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
Custom classes for extra styling #120
Comments
For others considering using -plus, I gave it a try noted a number of issues.
|
Good suggestions.
|
Looking only at your first example, a pattern such as [work]{.class} would be fairly simple to use with "replace" in postrender, although admittedly more difficult with code blocks. I just looked at the vue-markdown repo and dist/* is not minified, unlike -plus.
The security issue arises due to the inability to run "diff" to see what lines you had changed from the original. I ran into a real life example yesterday going to http://particlephysics.com/ which Ublock origin broke due to including: http://img.sedoparking.com/js/jquery-1.11.3.custom.min.js Turns out sedoparking is a known malware site, and worse nefarious scammers often claim to be providing "security improved versions". Finally, the prettify version is not really human readable. eg. it was fairly easily able to add the missing "tocAnchorLinkBefore" option to vue-markdown.
Try that with minified js. Yes, I could have got node and rebuilt the package, but that doesn't help when I was trying to debug the above problem. |
BTW, on the issue of security: your demo page I get The first result from a google search "beacon.min.js" is
Ok, maybe it's not actually malware, but minifying makes it difficult to determine tampering one way or another. |
That is most likely because I'm using cloudflare. I'm not getting that on my chrome browser. Which browser are you using, and which version is your browser? I'll turn off the feature anyways since it has no real use to me. |
I use chrome as well, but it is Ublock Origin blocking it, not the browser. |
I'll take a look. I'll generate both minified and non-minified versions. |
Funny. I also have uBlock. It's not happening to me. I turned off that feature and it shouldn't be an issue anymore. |
Actually I found out that markdown-it-katex has XSS vulnerabilities and it's not been updated for 4 years. Will look into some drop-in replacements. |
I realized there are some more serious issues with vue-markdown-it, as it doesn't protect against xss. It doesn't look trivial to solve it and I don't have the time to fix this at the moment. |
Do you mean there are xss problems outside of "html" and "katex"? |
Re: Katex. Looks to me like the xss exploit is only if you enable "raw html" in katex (disabled by default) |
|
There are two different issues here. The first and most important one is that vue-markdown use of Katex should (like emoji) be optional: see patch below. The other (katex not doing the right thing) is more open ended. And not really relevant to the 99.99% of markdown users who do not need math rendering. And sure, blog sites could still allow conditional math use via a moderator.
|
To answer your previous question, here is how we might use "postrender" to provide block spans with attributes. eg.
postrender looks something like:
FYI, I grabbed webpack, rebuilt vue-markdown adding spans/attributes: the result was buggy. |
I investigated a little more. The XSS issue seems to only apply to the simple html example but not the vue and webpack examples (both uses webpack). I'm not sure why that happens, but it seems like webpack is doing something to combat XSS. I'm waiting for my PR on markdown-it-katex to get accepted and I'll add a warning about this. |
Postrender looks complicated. I feel the whole point of markdown is to make things simple, and I feel having custom clas/id/attributes and slight modifications in CSS makes things very simple. Postrender can be used for fancier stuff. What do you mean by adding spans/attributes is buggy? I'm using |
My bad. After updating nodejs and webpack to all newest versions the problems with attrs went way. And yes, postrender is non-trivial. |
I was frustrated that there was no extra styling options available. The project was not actively maintained, and the dependencies are out of date and has security vulnerabilities. So I decided to fork the project and overhaul everything.
My package supports adding custom classes, ids, and attributes, so you would be able to more fancy styling with CSS. For example, you may want some images to be rendered small and some large, some centered and some aligned to the right. My new package would allow you to do so with ease.
Here's a demo: https://github.michaelmao.me/vue-markdown-plus. You can find it on NPM here: https://www.npmjs.com/package/vue-markdown-plus.
The text was updated successfully, but these errors were encountered: