I'm not sure why, but for some strange reason, Markdown images refuse to display when surrounded by

Recently, I've encountered a strange issue where my markdown image tag doesn't display the image when wrapped in a <div> or a <section>. Instead, it just outputs markdown code. Take a look at this screenshot for reference.

<section class="photoset">

![Image of San Francisco bay bridge from beach](/images/san-francisco.jpeg)

</section>

When I remove the HTML code, the image displays fine, albeit wrapped in paragraph tags, which isn't the issue. I understand why Jekyll does that to images, but what confuses me is why it doesn't work when wrapped in HTML tags now, even though it worked before.

Edited

<section class="photoset">

![Image of San Francisco bay bridge from beach](/images/san-francisco.jpeg)

</section>

<p><img src="/images/san-francisco.jpeg" alt="Image of San Francisco bay 
bridge from beach" /></p>

I experimented by removing the section tags and found that it works without them. It seems like there's something with the HTML tags preventing the markdown tags from functioning properly.

Answer №1

Markdown deliberately chooses not to process its formatting syntax within block-level HTML tags, as explained in the Markdown documentation:

Please note that Markdown formatting syntax is not applied within block-level HTML tags. For example, you cannot use Markdown-style *emphasis* inside an HTML block.

To include block-level HTML content, it must be written entirely in HTML format.

Answer №2

To enable kramdown to interpret kramdown syntax within block HTML tags, you must instruct it accordingly.

In your _config.yml file:

kramdown:
  # allow markdown parsing inside block-level HTML tags
  parse_block_html: true

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible to have a PHP variable embedded within an HTML link tag?

<?php $message = ' <a href="' . $link . '">here</a> '; ?> My goal is to include a clickable link in the $message variable for use in the mail() function. However, despite setting $link with the desired link string, it ...

Activate a Dropdown Menu by Clicking in a React Application

I have a collapsible feature where you can click to expand or collapse a dropdown. Currently, the dropdown can only be clicked on where the radio button is located. I want the entire area to be clickable so that users can choose the dropdown by clicking an ...

Toggle visibility of a div with bootstrap checkbox - enforce input requirements only if checkbox is marked

Lately, I've been facing a strange issue with using a checkbox that collapses a hidden div by utilizing bootstrap. When I include the attribute data-toggle="collapse" in the checkbox input section, the div collapses but it mandates every single one o ...

What are alternative methods for creating a table layout without relying on traditional table elements?

Is there a way to eliminate tables from my code and achieve the same layout in the name of progress and learning? Here is an example of the table I currently have: <table cellspacing="0px"> <tr> <td> <img src= ...

I encounter a black screen issue while attempting to rotate a three.js cube

How can I rotate a cube around all three axes (x, y, z) using the code snippet provided below? ` <html> <head> <title>CM20219 – Coursework 2 – WebGL</title> <meta charset="utf-8"> < ...

Displaying data in an HTML table using PHP and adding a popup

I've successfully created a PHP script that retrieves data from a MySQL database and organizes the results into an HTML table. Within one of the fields in the database, there are links to file(s), separated by commas. Everything is working well thanks ...

Here is a method to capture the redirected URL (href) of an <a> tag that has "href="javascript: return false"" but leads to a different URL when clicked

I am looking for a way to extract the redirected URL from an anchor tag without actually visiting it. I have tried using `selenium` `get_attribute('href')`, but all I get is "javascript: return false". Is there a method to obtain the redirected U ...

Display or conceal numerous WTForm labels

Is there a more efficient way to hide/show multiple wtform labels? Currently, I am achieving this with the following code: HTML: {{ render_field(var_1, class = "class_1") }} {{ render_field(var_2, class = "class_1") }} {{ render_field(var_3, class = " ...

I am attempting to create a captivating image for a "jumbotron"

My goal is to achieve a full-width image that stretches across the entire website. Furthermore, I want the image to remain centered and shrink from the sides as the window size decreases. Here's what I've attempted: HTML <div class="site-ban ...

Highcharts - Troubleshooting the chart reflow feature

Take a look at the fiddle I created. I encountered an issue with the chart width when toggling the sidebar. After seeking help on Stack Overflow from this post, I was able to solve it. Now, I'm facing another bug where adding transitions while togg ...

What could be causing my website to extend beyond 100% width?

I've been working tirelessly on solving this issue for the past week, but unfortunately, I haven't had any luck finding a solution. The problem arose as I was designing a launch page for a program that my friend is developing. Despite setting the ...

smoothly hide the dropdown menu when a link is clicked with a transition effect

I am struggling with two bugs in my dropdown menu that I can't seem to fix. The navigation links on my homepage take users to different sections of the page instantly when clicked. However, the issue arises when the dropdown menu does not close after ...

Sorting Json Data Using Vue

My experience with Vue.js led me to a challenge I can't quite figure out: how to filter specific data in a Json file. Let me provide more context: I have a Json file filled with various electronics products such as computers, mice, keyboards, etc. I w ...

Place a vertical slider adjacent to an HTML element on either the left or right side

I'm struggling to bind a range slider to the left or right side of a canvas that displays video. Despite my efforts, CSS seems to be putting up a strong fight. I can handle issues like stretching and slider values, but attaching it to the canvas is pr ...

Vuetify's offset feature seems to be malfunctioning as it does not

I'm facing an issue with the <v-flex> element in my code, specifically with the offset property not responding as expected. Despite following the recommended layout from the vuetify docs, I can't seem to get it right. Below you can see the ...

What could be causing my slider to malfunction?

No errors are being returned by the console. Currently utilizing Unslider. The setup includes: <div class="slider"> <ul> <li><img src="img/one.jpg" alt=""></li> <li><img src="img/one.jpg" ...

What is the best way to access dropdown sub-menu options from a complex multi-level navigation bar

Struggling to figure out how to open my dropdown sub-menu using CSS. Hoping to make it so the user can open it by hovering over the corresponding tag. I attempted to use #lablinksDD to trigger the opening of #ddSbMenu when hovered over #menuDD with #labLin ...

Error: Unable to assign value to the innerHTML property of an undefined element created by JavaScript

When designing my html form, I encountered an issue where I needed to display a message beneath blank fields when users did not fill them out. Initially, I used empty spans in the html code to hold potential error messages, which worked well. However, I de ...

Using md-chips and md-select together in multi select mode

I'm having trouble generating md-chips when selecting multiple values from an md-select. Does Md-chips only work with autocomplete analyzers and input fields? <md-chips ng-model="launchAPIQueryParams.type"> <md-select name="launchCalTy ...

Creating a custom Vue.js component for specific table cells within a table row - here's how!

My challenge is having related and neighboring table columns grouped within the same component in Vue.js. However, I'm facing a limitation with the template system where only one tag can be directly placed inside <template>. Typically, this wrap ...