Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Marijn van der Werf
    @marijnvdwerf
    Has anyone tried to add discourse-like [quote] tags to this library?
    e.g.:
    [quote="contrabig, post:6, topic:267, full:true"]
    My favourite Sopranos scene => Christopher's intervention
    https://www.youtube.com/watch?v=9_peSCECc4I
    [/quote]
    Nate Nolting
    @natenolting
    I'm running into an error with v0.11, I am using the the same as the sample basic usage
    Message: Argument 1 passed to League\CommonMark\Node\Node::appendChild() must be an instance of League\CommonMark\Node\Node, instance of League\CommonMark\Inline\Element\Text given, called in /home/site/vendor/league/commonmark/src/InlineParserEngine.php on line 103 and defined
    Ed Langley
    @fiddlerwoaroof
    Is there any way to convert the AST back to markdown?
    Colin O'Dell
    @colinodell
    Not at the moment. Eventually I'd like for both the commonmark and html-to-markdown projects to use the same AST which would allow this to occur, but don't expect to see this for a while (I simply don't have the time right now for such a massive rewrite of html-to-markdown).
    Ed Langley
    @fiddlerwoaroof
    The astwalker seems to terminate early if the ast is modified during walking.
    Is this intentional?
    Sergey Protko
    @fesor
    @fiddlerwoaroof are you redusing AST?
    Ed Langley
    @fiddlerwoaroof
    Reusing? yes.
    I just call $node->replaceWith(...) every once in a while, and it stops walking.
    Sergey Protko
    @fesor
    This is interesing, can you provide a little example?
    some kind of testcase for strange behaviour
    Ed Langley
    @fiddlerwoaroof
    Let me see if I can whip something up.
    If I comment out line 29, it runs through the whole input, otherwise it exits after the first element
    Sergey Protko
    @fesor
    walker remembers which node it should go next
    this is how nodejs implementation worked last time I’ve checked it
    in this case it remembers first child and you replaced it with new one, and walker just don’t know where to go next…
    Ed Langley
    @fiddlerwoaroof
    So, is that a bug or a feature?
    Sergey Protko
    @fesor
    is this something similar that you get?

    So, is that a bug or a feature?

    this is tottaly not a bug… but don’t want to call it feature. This is more like restriction)

    wait a second… will try something
    There is method resumeAt
    so you can tell walker which element to go next manually
    And i added this method for this particular usecase (modifing child nodes)
    Ed Langley
    @fiddlerwoaroof

    Hmm, it seems to give me an infinite loop if I do this:

    $newNode = new Text("new"); $node->firstChild()->replaceWith($newNode); $walker->resumeAt($newNode);

    hmm, maybe I want resumeAt($newNode, $entering=true)?
    Sergey Protko
    @fesor
    yep
    Ed Langley
    @fiddlerwoaroof
    That still gives me an infinite loop
    Sergey Protko
    @fesor
    hm… and this maybe a bug. Sorry, I can look at this a bit closer only tomorrow.
    Ed Langley
    @fiddlerwoaroof
    Ok, I updated the gist with the resumeAt version.
    Sergey Protko
    @fesor
    Thank you)
    Ed Langley
    @fiddlerwoaroof
    No problem
    Marijn van der Werf
    @marijnvdwerf
    I used to
    I used to solve this by using $walker->resumeAt(), followed by a $walker->next() whose output I ignored
    Tiago Alves
    @tiagoalves
    Hi! I need to access the commonmark docs for the 0.7 release since I need PHP 5.3 compatibility. Can anyone tell me if / how I can see the docs at https://commonmark.thephpleague.com but for version 0.7.2?
    Marijn van der Werf
    @marijnvdwerf
    Tiago Alves
    @tiagoalves
    Will do. Thanks!
    King Rayhan
    @kingRayhan
    markdown table is not working
    Mohit Jawanjal
    @mohitjawanjal
    Is this group active?
    Colin O'Dell
    @colinodell
    @kingRayhan league/commonmark does not support tables (it's not part of the spec). Have you tried using https://github.com/webuni/commonmark-table-extension?