Skip to content

Allow presentational HTML with Markdown like GitHub #125

Closed

Description

@sizzlemctwizzle

@OpenUserJs/admin @OpenUserJs/backend
I've made an experimental patch to the library we use for Markdown (marked) that allows some presentational HTML like you find on GitHub (see here for details).

I've added a branch to OpenUserJS.org that uses the modified library. You'll need to install the new library: npm install marked-whitelist-html

Please test it, try to find ways to break it, and do generally bad things so that it can be fixed and made secure. Thanks.

Activity

  1. added this to the milestone on Jun 2, 2014
  2. Martii commented on Jun 2, 2014

    @Martii
    Member

    You'll need to install the new library: npm install marked-whitelist-html

    Checking out a detached HEAD from an upstream tracking branch usually works for me... then in that folder I just type $ npm install which checks the current ./package.json file and downloads whatever is needed for the dev run. This is how I did it with the current UI branch.

    I'll need a few days to get back to this since the beginning of each month is my most busiest... but I'm looking forward to trying it out when I can. :)

  3. sizzlemctwizzle commented on Jun 2, 2014

    @sizzlemctwizzle
    MemberAuthor

    then in that folder I just type $ npm install which checks the current ./package.json file and downloads whatever is needed for the dev run.

    I had no idea you could do this. Thanks for the knowledge.

    I'll need a few days to get back to this

    Totally understandable. I didn't think this would be a quick change. I'm trying to modify a well written library and expect mistakes. Take as much time as you need to test my change.

  4. jerone commented on Jun 2, 2014

    @jerone
    Contributor

    You might want to give xss.js a try. It contains the whitelist you copied and more, especially the elements only allowed within a table.

  5. added a commit that references this issue on Jun 2, 2014
    e66d374
  6. sizzlemctwizzle commented on Jun 2, 2014

    @sizzlemctwizzle
    MemberAuthor

    Thank you so much for pointing out that library @jerone. It works great and I'm happy I don't have develop and maintain my own fork.

  7. Martii commented on Jun 3, 2014

    @Martii
    Member

    Uhmmm somethings wrong with markdown now and I haven't changed a thing. See this homepage.

  8. reopened this on Jun 3, 2014
  9. Zren commented on Jun 3, 2014

    @Zren
    Contributor

    Pretty sure xss sanitizes HTML, not Markdown. You probably want to reverse return marked(xss(text)); with return xss(marked(text));

  10. sizzlemctwizzle commented on Jun 3, 2014

    @sizzlemctwizzle
    MemberAuthor

    You probably want to reverse

    Thanks. Hopefully that fixes things.

  11. sizzlemctwizzle commented on Jun 3, 2014

    @sizzlemctwizzle
    MemberAuthor

    @Zren Since you're the one basically redoing the entire style of the site, do you mind giving anchor links a background image (icon) like GitHub so people can actually see and copy the url?

  12. Zren commented on Jun 3, 2014

    @Zren
    Contributor

    Mmmm. They would be nice to have. I'll have to look into how github does it
    and it and if there's already a npm package.

    This is the code GitHub uses for reference later.

    https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb

    On Mon, Jun 2, 2014 at 9:58 PM, Mike Medley notifications@github.com
    wrote:

    @Zren https://github.com/Zren Since you're the one basically redoing
    the entire style of the site, do you mind giving anchor links a background
    image (icon) like GitHub so people can actually see and copy the url?

    —
    Reply to this email directly or view it on GitHub
    #125 (comment)
    .

    / Chris

  13. sizzlemctwizzle commented on Jun 3, 2014

    @sizzlemctwizzle
    MemberAuthor

    Actually we have them, but you visually can't see them.
    On Jun 2, 2014 9:02 PM, "Chris Holland" notifications@github.com wrote:

    Mmmm. They would be nice to have. I'll have to look into how github does
    it
    and it and if there's already a npm package.

    This is the code GitHub uses for reference later.

    https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb

    On Mon, Jun 2, 2014 at 9:58 PM, Mike Medley notifications@github.com
    wrote:

    @Zren https://github.com/Zren Since you're the one basically redoing
    the entire style of the site, do you mind giving anchor links a
    background
    image (icon) like GitHub so people can actually see and copy the url?

    —
    Reply to this email directly or view it on GitHub
    <
    https://github.com/OpenUserJs/OpenUserJS.org/issues/125#issuecomment-44912239>

    .

    / Chris

    —
    Reply to this email directly or view it on GitHub
    #125 (comment)
    .

  14. Zren commented on Jun 3, 2014

    @Zren
    Contributor

    Ah that's right. There was that heading renderer func. Welp, that was easy.

  15. jerone commented on Jun 3, 2014

    @jerone
    Contributor

    Thank you so much for pointing out that library @jerone. It works great and I'm happy I don't have develop and maintain my own fork.

    Thought you'd like that. More feature complete and working great.

  16. added a commit that references this issue on Jun 20, 2014
  17. removed
    needs testingAnyone can add this but it is primarily there for the Assignee indicating that Testers are wanted.
    on Apr 27, 2015
  18. locked as resolved and limited conversation to collaborators on Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSomething we do have implemented already but needs improvement upon to the best of knowledge.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions