Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    ache
    @arobase-che

    Oh ! I forgot the AST.

    With this one, i must edit parse5 :

    root[2] (1:1-9:1, 0-81)
    ├─ form[1] (2:1-4:10, 1-38) [data={"hName":"form"}]
    │  └─ textarea[1] [data={"hName":"textarea"}]
    │     └─ text: "This is a textarea"
    └─ html: "<div>\nThis is `dangerous HTML` 🐯\n</div>" (6:1-8:7, 40-80)

    With that one(hand written), no need to edit parse5 :

    root[2] (1:1-9:1, 0-81)
    ├─ html: "<textarea>This is a textarea</textarea>" (2:1-4:10, 1-38)
    └─ html: "<div>\nThis is `dangerous HTML` 🐯\n</div>" (6:1-8:7, 40-80)

    It's why i don't think the bug comes from parse5 but from rehype raw.

    Titus
    @wooorm
    Hi @che! Your comments aren't very clear to me, could you add the code you’re using the run all this? And what is your plugin?
    From your AST, it looks like you’re combining remark and rehype in the same AST, maybe that’s what’s up?
    ache
    @arobase-che

    Oh sorry ! I tried my best to be understandable but i'm not used to remark, nor gitter, nor english in fact ... :flushed:

    All the code is here http://git.ache.one/markdown-viewer/blob/master/app.js

    Important part :

          unified()
          .use(remark)
          .use(mermaid)
          .use(textInput) // The plugin who deal with the textarea
          .use(math)
          .use(kbd)
          .use(highlight)
          .use(html, {allowDangerousHTML: true}) // This is remark-rehype
          .use(rehypeKatex)
          .use(raw)
          .use(rehypeStringify)
          .process(data, // [...]

    The code source of the plugin : http://git.ache.one/remark-text-input/

    I don't think there is a most important part but it's only 64 lines long. The plugin is about creating some interactives stuff from a Markdown document (in a same manner as Markdown)


    Maybe, i will check it this nigth and edit this text if i find something revelant. As i say i'm not used to remark.

    ache
    @arobase-che
    So i checked, and found nothing interesting :/
    Titus
    @wooorm
    Alright, thanks!
    This is probably not a bug in parse5
    You should probably not expose 'html' nodes from your plugin though, instead opting for embedded HAST. remark-math and remark-kbd do so as well: https://github.com/Rokt33r/remark-math/blob/0a0a0f826ff26ea51776faa1576d5f7ee9d1239a/packages/remark-math/block.js#L181-L194
    I saw you were working on that in the comments of your file: http://git.ache.one/remark-text-input/blob/master/app.js#L22
    However, you’re using children in that case (which is for markdown nodes), but you should be using data.hChildren (for the embedded HAST children)
    See the notes in the mdast-util-to-hast docs for more info! https://github.com/syntax-tree/mdast-util-to-hast#note
    Rémi Barraquand
    @barraq

    Hi @wooorm, I have a question regarding Remark. The mdast-util-to-hast plugin will create raw nodes when there is html element in the markdown parse with remark. As a result hast-util-sanitize will ignore those raw nodes and strip the html element, leaving only the text without markup.

    I saw that there is a rehype-rawplugin that rehidrate the raw, yet it will mean I have to use remark-to-rehype somehow.

    Is there a better way to reprocess an hast and convert raw nodes that contains html to hast-html-element?

    Rémi Barraquand
    @barraq
    self answser: use hast-util-raw ;)
    Titus
    @wooorm
    haha, yeah, that ;)
    Daniel Miller
    @Peaches491
    Hello , all! Anyone know why my vim autoformat (which uses Remark to do the formatting) is screwing up my colons?
    [^footnote]: becomes [^footnote]&#x3A;
    Maybe @wooorm knows?
     $ echo '[^footnote]:' | remark
    [^footnote]&#x3A;
    <stdin>: no issues found
    Daniel Miller
    @Peaches491
    Strange. This only seems to happen following a pair of square brackets:
     $ echo 'The strippers: JFK, Hitler, Stalin' | remark
    The strippers: JFK, Hitler, Stalin
    <stdin>: no issues found
    Titus
    @wooorm
    I like the oxford comma!
    Daniel Miller
    @Peaches491
    Haha, thanks. Me too!
    Titus
    @wooorm
    You can do that with --settings footnotes:true
    Daniel Miller
    @Peaches491
    Well that would do it! Thank you!
    Much better than my fix: let g:formatdef_remark_markdown = '"remark --quiet --no-color | sed ''s/&#x3A;/\:/g''"'
    Is there any particular reason that footnotes:true isn't the default?
    Also, @wooorm , are the various --settings documented somewhere?
    Titus
    @wooorm
    reason: because most places (commonmark, github) don’t support them (normally)
    @/all Hey folks! Happy New Year!
    A bit back I moved remark to its own organisation: remarkjs (https://github.com/remarkjs/remark).
    With that, unfortunately also comes a change in Gitter room, as they don’t migrate rooms (that I know of)
    If you have any questions, or would like to chat about markdown-related stuff, please use https://gitter.im/remarkjs/Lobby
    👋
    Norbert de Langen
    @ndelangen
    Good choice in my opinion
    Titus
    @wooorm
    Definitely! 👍
    Norbert de Langen
    @ndelangen
    Are you considering moving to an npm organization as well?
    They are free nowadays
    Titus
    @wooorm
    Can you ask that in the new room? That way my message above will stick to the bottom. 👍 Folks: please use https://gitter.im/remarkjs/Lobby !
    Wang Shidong
    @wsdjeg
    OK
    Wang Shidong
    @wsdjeg
    @wooorm what is the difference between using this room and lobby?
    Titus
    @wooorm
    This is the Gitter for the old repository. https://gitter.im/remarkjs/Lobby is based on the new organisation!
    Wang Shidong
    @wsdjeg
    Thanks, I got it
    Jayden Seric
    @jaydenseric
    I am finding this very confusing to work out: I have a markdown AST, and I want to use the ToC plugin on it and generate a markdown string. What is the right way to do that?
    This produces markdown, but the plugin is having no effect:
    const markdown = remark()
        .use(toc)
        .stringify(mdast) // The markdown AST
    Jayden Seric
    @jaydenseric
    Just realised this Gitter is dead, I'll repeat the above in the new one.
    Titus
    @wooorm
    correct, https://gitter.im/remarkjs/Lobby is where it’s at!
    Cédric Delpoux
    @xuopled
    Hello, is there a way to remove Paragraph tags from around images?
    My real need is: I want my blog post to be a little like medium (eg: https://medium.freecodecamp.org/how-to-build-a-react-and-gatsby-powered-blog-in-about-10-minutes-625c35c06481) The image larger than my text
    So I need to have different tags to apply a different style