How to add audio in Markdown?

Published on Aug. 22, 2023, 12:18 p.m.

To add audio in Markdown, you can use the <audio> tag with the src attribute to specify the URL of the audio file. However, note that Markdown itself does not support the <audio> tag, so you would need to use an HTML tag directly within a Markdown file. Here’s an example:

<audio src="/path/to/audio.mp3" controls>
Your browser does not support the audio tag.
</audio>

This will display an audio player in the generated HTML. The controls attribute will include play, pause, and volume controls for the audio file. The Your browser does not support the audio tag. text will be displayed if the user’s browser does not support the <audio> tag.

Keep in mind that different Markdown rendering engines may handle HTML elements differently, so you might want to test this in your specific environment to ensure that it works as expected.

Tags: