Try following way
<?php
namespace Company\Module\Helper;
class Data extends AbstractHelper
{
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Cms\Model\Template\FilterProvider $filterProvider
) {
parent::__construct($context);
$this->_filterProvider = $filterProvider;
}
public function getAttribute($text)
{
return $this->_filterProvider
->getBlockFilter()->filter($text);
}
}
addtocart.phtml
file:
<?php
$_product = $block->getProduct();
$demoStore = $_product->getResource()-getAttribute('extension_demo_details')->getFrontend()->getValue($_product);
$attr_label_for_demo =$_product->getResource()->getAttribute('extension_demo_details')->getStoreLabel();
$helperData = $this->helper('Company\Module\Helper\Data');
?>
<p><?php echo $helperData->getAttribute($demoStore); ?></p>
Using object manager
<?php
//Get Object Manager Instance
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$filterProvider = $objectManager->get('\Magento\Cms\Model\Template\FilterProvider');
echo $filterProvider->getBlockFilter()->filter($demoStore);