/** * constructor, see Markdownify::Markdownify() for more information */ function Markdownify_Extra($linksAfterEachParagraph = MDFY_LINKS_EACH_PARAGRAPH, $bodyWidth = MDFY_BODYWIDTH, $keepHTML = MDFY_KEEPHTML) { parent::Markdownify($linksAfterEachParagraph, $bodyWidth, $keepHTML); ### new markdownable tags & attributes # header ids: # foo {bar} $this->isMarkdownable['h1']['id'] = 'optional'; $this->isMarkdownable['h2']['id'] = 'optional'; $this->isMarkdownable['h3']['id'] = 'optional'; $this->isMarkdownable['h4']['id'] = 'optional'; $this->isMarkdownable['h5']['id'] = 'optional'; $this->isMarkdownable['h6']['id'] = 'optional'; # tables $this->isMarkdownable['table'] = array(); $this->isMarkdownable['thead'] = array(); $this->isMarkdownable['tbody'] = array(); $this->isMarkdownable['th'] = array('align' => 'optional'); $this->isMarkdownable['td'] = array('align' => 'optional'); $this->isMarkdownable['tr'] = array(); //array_push($this->ignore, 'thead'); //array_push($this->ignore, 'tbody'); //array_push($this->ignore, 'tfoot'); # definition lists $this->isMarkdownable['dl'] = array(); $this->isMarkdownable['dd'] = array(); $this->isMarkdownable['dt'] = array(); # footnotes $this->isMarkdownable['fnref'] = array('target' => 'required'); $this->isMarkdownable['footnotes'] = array(); $this->isMarkdownable['fn'] = array('name' => 'required'); $this->parser->blockElements['fnref'] = false; $this->parser->blockElements['fn'] = true; $this->parser->blockElements['footnotes'] = true; # abbr $this->isMarkdownable['abbr'] = array('title' => 'required'); # build RegEx lookahead to decide wether table can pe parsed or not $inlineTags = array_keys($this->parser->blockElements, false); $colContents = '(?:[^<]|<(?:' . implode('|', $inlineTags) . '|[^a-z]))+'; $this->tableLookaheadHeader = '{ ^\\s*(?:<thead\\s*>)?\\s* # open optional thead <tr\\s*>\\s*(?: # start required row with headers <th(?:\\s+align=("|\')(?:left|center|right)\\1)?\\s*> # header with optional align \\s*' . $colContents . '\\s* # contents </th>\\s* # close header )+</tr> # close row with headers \\s*(?:</thead>)? # close optional thead }sxi'; $this->tdSubstitute = '\\s*' . $colContents . '\\s* # contents </td>\\s*'; $this->tableLookaheadBody = '{ \\s*(?:<tbody\\s*>)?\\s* # open optional tbody (?:<tr\\s*>\\s* # start row %s # cols to be substituted </tr>)+ # close row \\s*(?:</tbody>)? # close optional tbody \\s*</table> # close table }sxi'; }