HTML tags in a block body are not rendred I'm using Drupal 8. I have created a custom installation profile. Inside the profile profileName.install file, I created the following function:  

function setupCustomBlocks() {
  $blockContent = BlockContent::create([
        'type' =&gt; 'basic',
        'info' =&gt; 'Why choose us?',
  ]);
  $blockContent-&gt;set('body', '&lt;p&gt;&lt;i class="fa fa-drupal"&gt;&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
                              &lt;p&gt;Lorem Ipsum is simply dummy text of the printing and typesetting industry.&lt;/p&gt;'
  );
  $blockContent-&gt;save();

  $block = Block::create([
        'id' =&gt; 'why_choose_us',
        'plugin' =&gt; 'block_content:' . $blockContent-&gt;uuid(),
        'region' =&gt; 'topwidget_first',
        'provider' =&gt; 'block_content',
        'weight' =&gt; 0,
        'theme' =&gt; \Drupal::config('system.theme')-&gt;get('default'),
        'visibility' =&gt; array(),
        'settings' =&gt; [
          'label' =&gt; 'Why choose us?',
          'label_display' =&gt; TRUE,
        ],
  ]);
  $block-&gt;save();
}  


The bellow function, allows me to create a custom block when I install the profile. Here is the result:  



As you can see, the HTML tags are not rendering. How can fix that?
It's rendering the block's content a plain text, not HTML, because you aren't setting the body field's format property when creating the BlockContent entity. 

$blockContent = \Drupal\block_content\Entity\BlockContent::create([ 'type' =&gt; 'basic', 'info' =&gt; 'Why choose us?' ]);
$blockContent-&gt;body-&gt;value = '&lt;p&gt;&lt;i class="fa fa-drupal"&gt;&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
                              &lt;p&gt;Lorem Ipsum is simply dummy text of the printing and typesetting industry.&lt;/p&gt;';
$blockContent-&gt;body-&gt;format = 'full_html';
$blockContent-&gt;save();