-
Notifications
You must be signed in to change notification settings - Fork 319
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
MD Editor: More buttons and such #168
Comments
Make sure we triple check the html markup sanitizing and md (gfm)... there's currently an issue with content in code fences being stripped nicely... haven't reported it yet because everyone can work around it with One exampled dev/production homepage for my display of the sample json. See also: |
Maybe I need to get my eyes checked, but what exactly is wrong with that json? What do you mean by "stripped nicely"? |
Should look like this: {
"Monkey Barrel": [
"/scripts/show/114843",
{
"recent posts": "/posts?kind=all",
"recent topics": "/topics",
"recent comments": "/comments",
"recent images": "/images",
"": "",
"recent spam": "/spam",
"recent potential spam": "/posts?kind=all&spam=1",
"recent potential spam by score": "/posts?kind=all&spam=score",
"spam and malware \u00bb": "/topics/9#posts-last",
"cookie stealing scripts \u00bb": "/topics/704#posts-last"
}
],
"Scripts": [
"/scripts",
{
"recent posts": "/posts?kind=script",
"recent reviews": "/reviews",
"recent potential spam": "/posts?kind=script&spam=1",
"recent potential spam by score": "/posts?kind=script&spam=score",
"": "",
"popular scripts": "/",
"all scripts by name": "/scripts?sort=name",
"most discussed": "/scripts?sort=posts",
"highest rated": "/scripts?sort=rating",
"most favorited": "/scripts?sort=fans",
"most installed": "/scripts?sort=installs",
" ": "",
"new script by upload": "/scripts/new",
"new script by pasting": "/scripts/new?form=true"
}
],
"Tags": [
"/tags",
{
"most frequently used tags": "/tags?sort=count",
"all tags by name": "/tags?page=1"
}
],
"Forums": [
"/forums",
{
"recent posts": "/posts?kind=forum",
"recent potential spam": "/posts?spam=1",
"recent potential spam by score": "/posts?kind=forum&spam=score",
"": "",
"script development": "/forums/1",
"ideas and script requests": "/forums/2",
"userscripts.org discussion": "/forums/3",
"the banana bar": "/forums/4",
"greasefire": "/forums/5"
}
],
"People": [
"/users",
{
"all members by name": "/users?page=1",
"all members by # of scripts": "/users?sort=scripts",
"all members by # of comments": "/users?sort=comments",
"all members by # of posts": "/users?sort=posts"
}
],
"Blog": [
"/articles",
{
"rss feed": "/feeds/recent_articles"
}
],
"Guides": [
"/guides",
{
"highest rated": "/guides?sort=votes",
"most discussed": "/guides?sort=comments",
"sorted by author": "/guides?sort=author",
"sorted by date": "/guides?sort=updated"
}
]
} but looks like this:
|
Hmmm. It stores fine, it must be somewhere in the rendering. https://openuserjs.org/admin/json?model=Script&id=537812c3fb78e9000055d860 Examples\r\n\r\n``` json\r\n{\r\n \"Monkey Barrel\": [\r\n \"/scripts/show/114843\",\r\n {\r\n \"recent posts\": \"/posts?kind=all\",\r\n \"recent topics\": \"/topics\",\r\n \"recent comments\": \"/comments\",\r\n \"recent images\": \"/images\",\r\n \"\": \"\",\r\n \"recent spam\": \"/spam\",\r\n \"recent potential spam\": \"/posts?kind=all&spam=1\",\r\n \"recent potential spam by score\": \"/posts?kind=all&spam=score\",\r\n \"spam and malware \\u00bb\": \"/topics/9#posts-last\",\r\n \"cookie stealing scripts \\u00bb\": \"/topics/704#posts-last\"\r\n }\r\n ],\r\n \"Scripts\": [\r\n \"/scripts\",\r\n {\r\n \"recent posts\": \"/posts?kind=script\",\r\n \"recent reviews\": \"/reviews\",\r\n \"recent potential spam\": \"/posts?kind=script&spam=1\",\r\n \"recent potential spam by score\": \"/posts?kind=script&spam=score\",\r\n \"\": \"\",\r\n \"popular scripts\": \"/\",\r\n \"all scripts by name\": \"/scripts?sort=name\",\r\n \"most discussed\": \"/scripts?sort=posts\",\r\n \"highest rated\": \"/scripts?sort=rating\",\r\n \"most favorited\": \"/scripts?sort=fans\",\r\n \"most installed\": \"/scripts?sort=installs\",\r\n \" \": \"\",\r\n \"new script by upload\": \"/scripts/new\",\r\n \"new script by pasting\": \"/scripts/new?form=true\"\r\n }\r\n ],\r\n \"Tags\": [\r\n \"/tags\",\r\n {\r\n \"most frequently used tags\": \"/tags?sort=count\",\r\n \"all tags by name\": \"/tags?page=1\"\r\n }\r\n ],\r\n \"Forums\": [\r\n \"/forums\",\r\n {\r\n \"recent posts\": \"/posts?kind=forum\",\r\n \"recent potential spam\": \"/posts?spam=1\",\r\n \"recent potential spam by score\": \"/posts?kind=forum&spam=score\",\r\n \"\": \"\",\r\n \"script development\": \"/forums/1\",\r\n \"ideas and script requests\": \"/forums/2\",\r\n \"userscripts.org discussion\": \"/forums/3\",\r\n \"the banana bar\": \"/forums/4\",\r\n \"greasefire\": \"/forums/5\"\r\n }\r\n ],\r\n \"People\": [\r\n \"/users\",\r\n {\r\n \"all members by name\": \"/users?page=1\",\r\n \"all members by # of scripts\": \"/users?sort=scripts\",\r\n \"all members by # of comments\": \"/users?sort=comments\",\r\n \"all members by # of posts\": \"/users?sort=posts\"\r\n }\r\n ],\r\n \"Blog\": [\r\n \"/articles\",\r\n {\r\n \"rss feed\": \"/feeds/recent_articles\"\r\n }\r\n ],\r\n \"Guides\": [\r\n \"/guides\",\r\n {\r\n \"highest rated\": \"/guides?sort=votes\",\r\n \"most discussed\": \"/guides?sort=comments\",\r\n \"sorted by author\": \"/guides?sort=author\",\r\n \"sorted by date\": \"/guides?sort=updated\"\r\n }\r\n ]\r\n}\r\n``` Edit: Er, of course it stores fine. We only sanitize/render when it gets parsed. Not sure why I was thinking the MD Editor would strip it out. |
Stripping is done by xss. Removing that call shows the json properly. |
Okay, the problem is that highlight.js is generating |
Would not stripping the |
You mean whitelisting the USO doesn't allow the Have you tried doing your original commit but whitelist This might be a bug in See also:
|
NOTE: More links added in previous post to examine Going to do some tests here... so this particular reply may change some: Define a table with GH gfm
Test to determine if GH gfm has a Btw if you didn't notice my Compatibility Matrix is also sanitized on OUJS now... most of my icons groupings are supposed to be centered with the class that is added via Swipe the GH generated output table source and repost as markup
... result: ALLOWS NOTE: This p tag has classy as a class .... result: SANITIZED Applying the `align` attribute for `p` tag.. should be far `right` ... result: SUCCESS with a consequence of GH gfm FAILING |
Advantages: * **Works** unlike simple-xss * Lots of maintainers/contributors * Smaller than simple-xss * Correctly allows sanitizing text **first** then applying markdown * Optional list is included for current defaults... this **can be removed** but I would feel safer matching it in case something comes down the line we don't like. * Does filter out `javascript:` items just like xss [npm homepage](https://www.npmjs.org/package/sanitize-html) [gh homepage](https://github.com/punkave/sanitize-html) Related: * OpenUserJS#168 * OpenUserJS#125 Tested in dev on [this page](http://localhost:8080/scripts/marti/httplocalhost.localdomain/RFC_2606%C2%A73_-_license_and_licence_Unit_Test)
So bringing this back to topic basically we're missing "pin" which I don't recommend keeping our comment reply box open constantly. It has full screen editing now which is pretty good. The other thing I see @jerone 's script is horizontal rule e.g. What buttons does anyone want to see? I would love to see a "Reply and Close" button on Issue discussions if possible... any thoughts? |
Reiterating again... will close soon if there isn't any interest. |
Investigated this. bootstrap-markdown only supports jQuery Due to migration away from jQuery in our core, esp. in the client-side scripts, this is now not programmatically an option. e.g. Does not currently work with We could however fork the project and hard code the needed buttons. We would need to maintain this with all upstream changes. Currently strike is missing and GFM tables... both of which are specific to GFM. CommonMark may have something different available but it's still newer to the scene. It is possible to append those using jQuery and their API however it's quite messy to get the buttons in the right order. But I'm going to close this very soon due to complete lack of interest shown. I really think there are plenty of buttons already. |
So looked into Jerones script source... he mixes markup with markdown. e.g. The more I think of this the better it would be to do this .user.js client-side if more are wanted. Dabbling on a local copy of bootstrap-markdown this can be achieved directly, and in jQuery currently, but again order is the thing when just adding buttons the "normal way" (via that maintainers API). I'm at a -1 for modifying bootstrap-markdown... way too messy. Btw last chance to convince otherwise. |
https://openuserjs.org/discuss/The_new_layout
https://toopay.github.io/bootstrap-markdown/
https://github.com/toopay/bootstrap-markdown/blob/master/js/bootstrap-markdown.js#L750
The text was updated successfully, but these errors were encountered: