I'm trying to nest markdown in an HTML file while using Jekyll. Is there a way to achieve something like the following?
# index.html --- layout: default --- <p>[Stack Overflow](http://www.stackoverflow.com)</p>
Note: I'm aware that I could do this instead.
# index.html --- layout: default --- <p><a href="http://www.stackoverflow.com">Stack Overflow</a></p>
For any markup that is not covered by Markdown's syntax, you simply use HTML itself. There's no need to preface it or delimit it to indicate that you're switching from Markdown to HTML; you just use the tags. The only restrictions are that block-level HTML elements — e.g. <div> , <table> , <pre> , <p> , etc.
By default, Jekyll uses the kramdown Markdown processor with stock settings, but you can enable other kramdown options or even switch Jekyll to another Markdown processor. See the Jekyll Markdown configuration options documentation for more information.
Your Jekyll pages consist of HTML, CSS, and JavaScript, so pretty much any code you need to embed will work without a problem. As you integrate code for these services, note that if a page in your Jekyll site doesn't have front matter tags, Jekyll won't process any of the content in that page.
Not only is it okay to do, but it is encouraged. As the rules state: For any markup that is not covered by Markdown's syntax, you simply use HTML itself.
If you are using Kramdown, based on their doc you can do this:
<div markdown="1"> My text with **markdown** syntax </div>
And this way, the text within the div
is rendered as markdown.
Make sure to use the .md
or .markdown
extension for the file, as .html
files aren't sent to Kramdown for processing!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With