Code Monkey home page Code Monkey logo

Comments (4)

casteldev avatar casteldev commented on July 18, 2024 1

Hi,

Using composer require erusev/parsedown-extra to install, you got the broken 0.8.1 release.
This is confusing.
0.8.1 release should be remove, I think.

from parsedown-extra.

cocochepeau avatar cocochepeau commented on July 18, 2024

I'm also encountering this issue.

from parsedown-extra.

hrvoj3e avatar hrvoj3e commented on July 18, 2024

Bug or not?
These are the values of variables before preg_match.
But parent::blockHeader does not return ['element']['text'] anymore.

// $Line
array ( 'body' => '# Some title text', 'indent' => 0, 'text' => '# Some title text', )

// $Block
array ( 'element' => array ( 'name' => 'h1', 'handler' => array ( 'function' => 'lineElements', 'argument' => 'Some title text', 'destination' => 'elements', ), ), )
    protected function blockHeader($Line)
    {
        $Block = parent::blockHeader($Line);

        if (! isset($Block)) {
            return null;
        }

        if (preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE))
        {
            $attributeString = $matches[1][0];
            $Block['element']['attributes'] = $this->parseAttributeData($attributeString);
            $Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]);
        }

        return $Block;
    }

Parsedown: 1.8.0-beta-7
ParsedownExtra: 0.8.1

Going back to ParsedownExtra: 0.8.0

from parsedown-extra.

netniV avatar netniV commented on July 18, 2024

This is a bug, and I've documented it in my own netniV/ParsedownID#1 tracker just now... which i've copied here for completeness:

This seems to occur due to a mismatch between parsedown v1.8.0-beta7 and parse-extra v0.8.1. In the latest version of Parsedown, the blockHeader element is returned without the text attribute from the blockHeader function.

v1.7.4
$Block = array(
    'element' => array(
        'name' => 'h' . min(6, $level),
        'text' => $text,
        'handler' => 'line',
    ),
);
v1.8.0-beta7
$Block = array(
    'element' => array(
        'name' => 'h' . min(6, $level),
        'handler' => array(
            'function' => 'lineElements',
            'argument' => $text,
            'destination' => 'elements',
        )
    ),
);

I foresee that the way to correct this would be to patch parsedown-extra to see if the text element exists and if not, see if the handler is an array, thus use the argument value. Alternatively, release a 0.8.2 version that depends on the beta-7 version with the correct usage.

I have also suggested that Parsedown 1.8.0-beta7 be published as a full version now since it's not been updated in almost a year erusev/parsedown#765 (comment)

from parsedown-extra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.