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