Diff
checker
टेक्स्ट
टेक्स्ट
छवियां
दस्तावेज़
Excel
फ़ोल्डर्स
Legal
Enterprise
डेस्कटॉप
मूल्य
साइन इन करें
Diffchecker डेस्कटॉप डाउनलोड करें
टेक्स्ट की तुलना करें
दो टेक्स्ट फ़ाइलों के बीच अंतर ढूंढें
उपकरण
इतिहास
प्रदर्शन
लेआउट
विभाजित
संयुक्त
रियल-टाइम एडिटर
रिक्त स्थान छिपाएँ
अपरिवर्तित संक्षिप्त करें
लाइन रैप बंद
परिवर्तन हाइलाइट करें
स्मार्ट
सिंटैक्स
कोई नहीं
दिखावट बदलें
प्रोसेसिंग
अनदेखा करें
टेक्स्ट बदलें
पहले अंतर पर जाएँ
इनपुट संपादित करें
Diffchecker Desktop
Diffchecker चलाने का सबसे सुरक्षित तरीका। Diffchecker Desktop ऐप पाएं: आपके diffs कभी आपके कंप्यूटर से बाहर नहीं जाते!
Desktop पाएं
MarkdownHelper
बनाया गया
4 वर्ष पहले
Diff कभी समाप्त नहीं होता
साफ़
निर्यात करें
शेयर करें
समझाएं
23 हटाए गए
लाइनें
कुल
हटाया गया
अक्षर
कुल
हटाया गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
250 लाइनें
सभी को कॉपी करें
29 जोड़े गए
लाइनें
कुल
जोड़ा गया
अक्षर
कुल
जोड़ा गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
252 लाइनें
सभी को कॉपी करें
<?php
<?php
namespace sij\humhub\modules\rss\components;
namespace sij\humhub\modules\rss\components;
/**
/**
* A collection of useful methods to assist working with Markdown text.
* A collection of useful methods to assist working with Markdown text.
*/
*/
class MarkdownHelper {
class MarkdownHelper {
private static $article;
private static $article;
private static $level;
private static $level;
public static $logFileHandle = false;
public static $logFileHandle = false;
public static $cfg_pictures = 'yes';
public static $cfg_pictures = 'yes';
public static $cfg_maxwidth = 500;
public static $cfg_maxwidth = 500;
public static $cfg_maxheight = 500;
public static $cfg_maxheight = 500;
/**
/**
* Makes the supplied text safe to use as Markdown.
* Makes the supplied text safe to use as Markdown.
*/
*/
public static function escape($text)
public static function escape($text)
{
{
return str_replace(
return str_replace(
[ '\\', '-', '#', '*', '+', '`', '.', '[', ']', '(', ')', '!', '<', '>', '_', '{', '}', ],
[ '\\', '-', '#', '*', '+', '`', '.', '[', ']', '(', ')', '!', '<', '>', '_', '{', '}', ],
[ '\\\\', '\-', '\#', '\*', '\+', '\`', '\.', '\[', '\]', '\(', '\)', '\!', '\<', '\>', '\_', '\{', '\}', ],
[ '\\\\', '\-', '\#', '\*', '\+', '\`', '\.', '\[', '\]', '\(', '\)', '\!', '\<', '\>', '\_', '\{', '\}', ],
$text
$text
);
);
}
}
private static function log($text) {
private static function log($text) {
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
if (
$this->
logFileHandle ) {
if (
self::$
logFileHandle ) {
fwrite(
$this->
logFileHandle, $text);
fwrite(
self::$
logFileHandle, $text);
}
}
}
}
/**
/**
* Translates a HTML document into Markdown syntax
* Translates a HTML document into Markdown syntax
*/
*/
public static function translateHTML($html) {
public static function translateHTML($html) {
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
$doc = new \DomDocument(
);
$doc = new \DomDocument(
'1.0', 'UTF-8'
);
$doc->loadHTML(
mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'),
LIBXML_NOCDATA
);
$doc->loadHTML(
mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'),
LIBXML_NOCDATA
);
$this->
article =
''
;
self::$
article =
""
;
$this->
level = 0;
self::$
level = 0;
self::translateNode($doc->documentElement);
self::translateNode($doc->documentElement);
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
$this->
article = preg_replace(
self::$
article = preg_replace(
['/ +/', '/ +\n/'],
['/ +/', '/ +\n/'],
[' ', "\n" ],
[' ', "\n" ],
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
$this->
article
self::$
article
);
);
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
return trim(
$this->
article);
return trim(
self::$
article);
}
}
/**
/**
* Translate the HTML body of the RSS new item into Markdown syntax
* Translate the HTML body of the RSS new item into Markdown syntax
*/
*/
private static function translateNode($node)
private static function translateNode($node)
{
{
switch ( $node->nodeType ) {
switch ( $node->nodeType ) {
case XML_TEXT_NODE:
case XML_TEXT_NODE:
$text = trim(preg_replace('/\s+/', ' ', $node->textContent));
$text = trim(preg_replace('/\s+/', ' ', $node->textContent));
self::log("\n### Text: |${text}|");
self::log("\n### Text: |${text}|");
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
$this->
article .= self::escape($text);
self::$
article .= self::escape($text);
break;
break;
case XML_ELEMENT_NODE:
case XML_ELEMENT_NODE:
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
self::log("\n### node " .
$this->
level . " " . strtolower($node->nodeName));
self::log("\n### node " .
self::$
level . " " . strtolower($node->nodeName));
switch ( strtolower($node->nodeName) ) {
switch ( strtolower($node->nodeName) ) {
case 'h1':
case 'h1':
$before = "\n# ";
$before = "\n# ";
$after = "\n";
$after = "\n";
$enter = true;
$enter = true;
break;
break;
case 'h2':
case 'h2':
$before = "\n## ";
$before = "\n## ";
$after = "\n";
$after = "\n";
$enter = true;
$enter = true;
break;
break;
case 'h3':
case 'h3':
$before = "\n### ";
$before = "\n### ";
$after = "\n";
$after = "\n";
$enter = true;
$enter = true;
break;
break;
case 'h4':
case 'h4':
$before = "\n#### ";
$before = "\n#### ";
$after = "\n";
$after = "\n";
$enter = true;
$enter = true;
break;
break;
case 'h5':
case 'h5':
$before = "\n##### ";
$before = "\n##### ";
$after = "\n";
$after = "\n";
$enter = true;
$enter = true;
break;
break;
case 'h6':
case 'h6':
$before = "\n###### ";
$before = "\n###### ";
$after = "\n";
$after = "\n";
$enter = true;
$enter = true;
break;
break;
case 'center' :
case 'center' :
case 'article' :
case 'article' :
सेव किए गए Diffs
ऑरिजनल टेक्स्ट
फ़ाइल खोलें
<?php namespace sij\humhub\modules\rss\components; /** * A collection of useful methods to assist working with Markdown text. */ class MarkdownHelper { private static $article; private static $level; public static $logFileHandle = false; public static $cfg_pictures = 'yes'; public static $cfg_maxwidth = 500; public static $cfg_maxheight = 500; /** * Makes the supplied text safe to use as Markdown. */ public static function escape($text) { return str_replace( [ '\\', '-', '#', '*', '+', '`', '.', '[', ']', '(', ')', '!', '<', '>', '_', '{', '}', ], [ '\\\\', '\-', '\#', '\*', '\+', '\`', '\.', '\[', '\]', '\(', '\)', '\!', '\<', '\>', '\_', '\{', '\}', ], $text ); } private static function log($text) { if ( $this->logFileHandle ) { fwrite($this->logFileHandle, $text); } } /** * Translates a HTML document into Markdown syntax */ public static function translateHTML($html) { $doc = new \DomDocument(); $doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'), LIBXML_NOCDATA); $this->article = ''; $this->level = 0; self::translateNode($doc->documentElement); $this->article = preg_replace( ['/ +/', '/ +\n/'], [' ', "\n" ], $this->article ); return trim($this->article); } /** * Translate the HTML body of the RSS new item into Markdown syntax */ private static function translateNode($node) { switch ( $node->nodeType ) { case XML_TEXT_NODE: $text = trim(preg_replace('/\s+/', ' ', $node->textContent)); self::log("\n### Text: |${text}|"); $this->article .= self::escape($text); break; case XML_ELEMENT_NODE: self::log("\n### node " . $this->level . " " . strtolower($node->nodeName)); switch ( strtolower($node->nodeName) ) { case 'h1': $before = "\n# "; $after = "\n"; $enter = true; break; case 'h2': $before = "\n## "; $after = "\n"; $enter = true; break; case 'h3': $before = "\n### "; $after = "\n"; $enter = true; break; case 'h4': $before = "\n#### "; $after = "\n"; $enter = true; break; case 'h5': $before = "\n##### "; $after = "\n"; $enter = true; break; case 'h6': $before = "\n###### "; $after = "\n"; $enter = true; break; case 'center' : case 'article' : case 'aside' : case 'div' : case 'footer' : case 'header' : case 'main' : case 'p': case 'section' : $before = "\n\n"; $after = "\n\n"; $enter = true; break; case 'br': $before = "\n"; $after = ""; $enter = false; break; case 'b': case 'kbd' : case 'mark' : case 'strong' : $before = "**"; $after = "**"; $enter = true; break; case 'dfn' : case 'em': case 'i': case 'var' : $before = "_"; $after = "_"; $enter = true; break; case 's': case 'strike': case 'del': $before = "~~"; $after = "~~"; $enter = true; break; case 'blockquote': case 'q' : $before = "\n> "; $after = "\n"; $enter = true; break; case 'a': $before = " ["; $after = "](" . $node->getAttribute('href') . ") "; $enter = true; break; case 'img': if ($this->cfg_pictures == 'yes' ) { $width = $node->getAttribute('width'); $height = $node->getAttribute('height'); if ( $width ) { if ( $width > $this->cfg_maxwidth ) { if ( $height ) { $height = floor($height * $this->cfg_maxwidth / $width); } $width = $this->cfg_maxwidth; } } if ( $height ) { if ( $height > $this->cfg_maxheight ) { if ( $width ) { $width = floor($width * $this->cfg_maxheight / $height); } $height = $this->cfg_maxheight; } } $size = ' =' . $width . 'x' . $height; if ( $size = ' =x' ) { $size = ''; } $before = " ![" . $node->getAttribute('alt') . "]"; $after = "(" . $node->getAttribute('src') . $size . ") "; } else { $before = ''; $after = ''; } $enter = false; break; case 'hr': $before = "\n\n---\n\n"; $after = ""; $enter = false; break; case 'abbr' : case 'acronym' : case 'address' : case 'big' : case 'body' : case 'cite' : case 'figcaption' : case 'figure' : case 'html' : case 'ins' : case 'small' : case 'span' : case 'sub' : case 'sup' : case 'time' : case 'u' : case 'wbr' : $before = ""; $after = ""; $enter = true; break; case 'table' : $before = "\n"; $after = "\n"; $enter = true; break; case 'tr' : case 'th' : case 'td' : case 'thead' : case 'tbody' : case 'tfoot' : case 'caption' : $before = " "; $after = " "; $enter = true; break; default : $before = ""; $after = ""; $enter = false; } self::log("\nBefore: |${before}|"); self::log("\nAfter: |${after}|"); $this->article .= $before; if ( $enter ) { $this->level++; self::log("\nEntering... " . $this->level); foreach ( $node->childNodes as $child ) { self::translateNode($child); } self::log("\nExiting... " . $this->level); $this->level--; } else { self::log("\nSkipping..."); } $this->article .= $after; } } }
परिवर्तित टेक्स्ट
फ़ाइल खोलें
<?php namespace sij\humhub\modules\rss\components; /** * A collection of useful methods to assist working with Markdown text. */ class MarkdownHelper { private static $article; private static $level; public static $logFileHandle = false; public static $cfg_pictures = 'yes'; public static $cfg_maxwidth = 500; public static $cfg_maxheight = 500; /** * Makes the supplied text safe to use as Markdown. */ public static function escape($text) { return str_replace( [ '\\', '-', '#', '*', '+', '`', '.', '[', ']', '(', ')', '!', '<', '>', '_', '{', '}', ], [ '\\\\', '\-', '\#', '\*', '\+', '\`', '\.', '\[', '\]', '\(', '\)', '\!', '\<', '\>', '\_', '\{', '\}', ], $text ); } private static function log($text) { if ( self::$logFileHandle ) { fwrite(self::$logFileHandle, $text); } } /** * Translates a HTML document into Markdown syntax */ public static function translateHTML($html) { $doc = new \DomDocument('1.0', 'UTF-8'); $doc->loadHTML( mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'), LIBXML_NOCDATA ); self::$article = ""; self::$level = 0; self::translateNode($doc->documentElement); self::$article = preg_replace( ['/ +/', '/ +\n/'], [' ', "\n" ], self::$article ); return trim(self::$article); } /** * Translate the HTML body of the RSS new item into Markdown syntax */ private static function translateNode($node) { switch ( $node->nodeType ) { case XML_TEXT_NODE: $text = trim(preg_replace('/\s+/', ' ', $node->textContent)); self::log("\n### Text: |${text}|"); self::$article .= self::escape($text); break; case XML_ELEMENT_NODE: self::log("\n### node " . self::$level . " " . strtolower($node->nodeName)); switch ( strtolower($node->nodeName) ) { case 'h1': $before = "\n# "; $after = "\n"; $enter = true; break; case 'h2': $before = "\n## "; $after = "\n"; $enter = true; break; case 'h3': $before = "\n### "; $after = "\n"; $enter = true; break; case 'h4': $before = "\n#### "; $after = "\n"; $enter = true; break; case 'h5': $before = "\n##### "; $after = "\n"; $enter = true; break; case 'h6': $before = "\n###### "; $after = "\n"; $enter = true; break; case 'center' : case 'article' : case 'aside' : case 'div' : case 'footer' : case 'header' : case 'main' : case 'p': case 'section' : $before = "\n\n"; $after = "\n\n"; $enter = true; break; case 'br': $before = "\n"; $after = ""; $enter = false; break; case 'b': case 'kbd' : case 'mark' : case 'strong' : $before = "**"; $after = "**"; $enter = true; break; case 'dfn' : case 'em': case 'i': case 'var' : $before = "_"; $after = "_"; $enter = true; break; case 's': case 'strike': case 'del': $before = "~~"; $after = "~~"; $enter = true; break; case 'blockquote': case 'q' : $before = "\n> "; $after = "\n"; $enter = true; break; case 'a': $before = " ["; $after = "](" . $node->getAttribute('href') . ") "; $enter = true; break; case 'img': if ( self::$cfg_pictures == 'yes' ) { $width = $node->getAttribute('width'); $height = $node->getAttribute('height'); if ( $width ) { if ( $width > self::$cfg_maxwidth ) { if ( $height ) { $height = floor($height * self::$cfg_maxwidth / $width); } $width = self::$cfg_maxwidth; } } if ( $height ) { if ( $height > self::$cfg_maxheight ) { if ( $width ) { $width = floor($width * self::$cfg_maxheight / $height); } $height = self::$cfg_maxheight; } } $size = ' =' . $width . 'x' . $height; if ( $size = ' =x' ) { $size = ''; } $before = " ![" . $node->getAttribute('alt') . "]"; $after = "(" . $node->getAttribute('src') . $size . ") "; } else { $before = ''; $after = ''; } $enter = false; break; case 'hr': $before = "\n\n---\n\n"; $after = ""; $enter = false; break; case 'abbr' : case 'acronym' : case 'address' : case 'big' : case 'body' : case 'cite' : case 'figcaption' : case 'figure' : case 'html' : case 'ins' : case 'small' : case 'span' : case 'sub' : case 'sup' : case 'time' : case 'u' : case 'wbr' : $before = ""; $after = ""; $enter = true; break; case 'table' : $before = "\n"; $after = "\n"; $enter = true; break; case 'tr' : case 'th' : case 'td' : case 'thead' : case 'tbody' : case 'tfoot' : case 'caption' : $before = " "; $after = " "; $enter = true; break; default : $before = ""; $after = ""; $enter = false; } self::log("\nBefore: |${before}|"); self::log("\nAfter: |${after}|"); self::$article .= $before; if ( $enter ) { self::$level++; self::log("\nEntering... " . self::$level); foreach ( $node->childNodes as $child ) { self::translateNode($child); } self::log("\nExiting... " . self::$level); self::$level--; } else { self::log("\nSkipping..."); } self::$article .= $after; } } }
अंतर खोजें