{"id":15288847,"url":"https://github.com/veganstraightedge/markdown_media","last_synced_at":"2025-04-13T08:11:26.707Z","repository":{"id":56882800,"uuid":"91207497","full_name":"veganstraightedge/markdown_media","owner":"veganstraightedge","description":"A [[ URL ]] syntax to embed media into views.","archived":false,"fork":false,"pushed_at":"2024-04-27T06:51:22.000Z","size":94,"stargazers_count":5,"open_issues_count":5,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-27T07:31:19.849Z","etag":null,"topics":["gem","markdown","media","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/veganstraightedge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-13T23:01:02.000Z","updated_at":"2024-06-19T15:43:15.152Z","dependencies_parsed_at":"2024-06-19T15:43:13.995Z","dependency_job_id":"ba7824f7-4896-4a21-8bea-2c16bc5ba39e","html_url":"https://github.com/veganstraightedge/markdown_media","commit_stats":{"total_commits":68,"total_committers":6,"mean_commits":"11.333333333333334","dds":"0.13235294117647056","last_synced_commit":"cbb3fb89706b47bb10d41b41fa148d89fbb15406"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veganstraightedge%2Fmarkdown_media","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veganstraightedge%2Fmarkdown_media/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veganstraightedge%2Fmarkdown_media/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veganstraightedge%2Fmarkdown_media/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/veganstraightedge","download_url":"https://codeload.github.com/veganstraightedge/markdown_media/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248681491,"owners_count":21144700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gem","markdown","media","ruby","ruby-on-rails"],"created_at":"2024-09-30T15:53:22.964Z","updated_at":"2025-04-13T08:11:26.676Z","avatar_url":"https://github.com/veganstraightedge.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markdown Media\n\n[![Code Climate](https://codeclimate.com/github/veganstraightedge/markdown_media/badges/gpa.svg)](https://codeclimate.com/github/veganstraightedge/markdown_media)\n![Version 2.0.0](https://img.shields.io/badge/VERSION-2.0.0-green.svg)\n\nThis syntax uses doubles square brackets on each side of a URL and optional options.\nIt expands into the current preferred embed code for that site’s media or raw media.\nSupported media types: YouTube, Vimeo, Instagram, Twitter, Daily Motion, images, videos, audios.\n\n\n## Installation\n\nAdd this line to your application’s Gemfile:\n\n```ruby\ngem 'markdown_media'\n```\n\nAnd then execute:\n\n```sh\nbundle\n```\n\nOr install it yourself as:\n\n```sh\ngem install markdown_media\n```\n\n\n## Usage\n\n### As a Writer\n\nThis a syntax that can sit on top of Markdown (or any templating format, except MediaWiki which already uses the double square bracket syntax). The purpose is to simplify adding images (with or without caption and optionally linked), videos, tweets, audio, etc for writers in a CMS. The HTML that we want for a video is different from an image. But as a writer, it’s conceptually the same, “here’s a piece of media and its caption, stick it in the page right here”.\n\nSo, the media embed syntax makes it so you don’t have to think about the differences between YouTube, Vimeo, Twitter and an image. Here’s how it works.\n\nThere are six pieces. Some are required. Some are optional. It must always be on one line. But for explanation here, I’ll put them on separate lines, then tie it all together.\n\n```\n[[\nmedia URL\ncaption\nlink URL (for images only)\nHTML id\nHTML class\ntype (used for Twitter video)\n]]\n```\n\nHere’s what they all mean.\n\n- **Required**. Always put a blank line above the media embed\n- **Required**. Always start the media embed with two left square brackets (no space between them).\n- **Required**. Always add an absolute URL to the media. (More on supported URLs below)\n- **Optional**. You can add a caption to images, videos, audios. Not for tweets though. The caption is processed as Markdown. So, you can use links, bold, and italics within the caption.\n- **Optional**. You can add a URL that will be used to link the image. This can only be used for images, not video, audio, or tweets.\n- **Optional**. If you need the media to have a certain id on the generated HTML (so that you can link to it), you can add id:desired-id-with-no-spaces as the last item in the media embed.\n- **Required**. Always end the media embed with two right square brackets (no space between them).\n- **Required**. Always put a blank line below the media embed\n\n### As a Developer\n\n```ruby\nMarkdownMedia.parse('[[https://example.com/photo.png]]')\n```\n\nIn Rails, you might also need to add `.html_safe` to avoid escaping.\n\n```ruby\nMarkdownMedia.parse('[[https://example.com/photo.png]]').html_safe\n```\n\n### Examples\n\n#### Images\n\nA simple image.\n\n```\n[[https://example.com/image.png]]\n```\n\nAn image with a caption.\n\n```\n[[https://example.com/image.png Look at me, I’m a caption!]]\n```\n\nAn image with Markdown in the caption.\n\n```\n[[https://example.com/image.png _Look at me_, I’m a **caption**!]]\n```\n\nAn image linked to a URL (requires a caption present).\n\n```\n[[https://example.com/image.png Some caption https://example.com/some/path]]\n```\n\nAn image linked to a path (requires a caption present).\n\n```\n[[https://example.com/image.png Some caption /books/work]]\n```\n\n#### Videos\n\nA simple video.\n\n```\n[[https://example.com/video.mp4]]\n```\n\nA video with a caption.\n\n```\n[[https://example.com/video.mp4 Even videos can have captions. Yay!]]\n```\n\nA video from Vimeo.\n\n```\n[[https://vimeo.com/2696386]]\n```\n\nA video from Vimeo with caption.\n\n```\n[[https://vimeo.com/2696386 History of the Internet]]\n```\n\nA video from YouTube.\n\n```\n[[https://www.youtube.com/watch?v=YX40hbAHx3s]]\n```\n\nA video from YouTube with caption.\n\n```\n[[https://www.youtube.com/watch?v=YX40hbAHx3s P vs. NP and the Computational Complexity Zoo]]\n```\n\nYouTube’s short URL format also works.\n\n```\n[[https://youtu.be/YX40hbAHx3s]]\n```\n\nYouTube’s embed URL format also works.\n\n```\n[[https://www.youtube.com/embed/YX40hbAHx3s]]\n```\n\nA video from Daily Motion.\n\n```\n[[http://www.dailymotion.com/video/x5gwr1v_anarchists-in-rojava-announce-irpgf_news]]\n```\n\nA video from Twitter.\n\n```\n[[https://twitter.com/Breaking911/status/900211169734131713 type:video]]\n```\n\nA video/gif from Giphy.\n\n```\n[[https://giphy.com/gifs/cat-funny-OrNbkY7oQOrh6]]\n```\n\nA video/gif from Giphy with caption.\n\n```\n[[https://giphy.com/gifs/cat-funny-OrNbkY7oQOrh6 Dogs and cats are buddies.]]\n```\n\n#### Audio\n\nA simple audio.\n\n```\n[[https://example.com/sound.mp3]]\n```\n\nA simple audio with caption.\n\n```\n[[https://example.com/sound.aac Sounds can have captions.]]\n```\n\n#### Links\n\nAny URL in a [[]] block that is unrecognized, just gets rendered into a linked URL.\n\n```\n[[https://veganstraightedge.com/cancer]]\n```\n\nThat gets turned into this.\n\n```html\n\u003ca href='https://veganstraightedge.com/cancer'\u003ehttps://veganstraightedge.com/cancer\u003c/a\u003e.\n```\n\nIf you try to embed some piece of media and it renders to a URL that means that that kind of URL isn’t supported yet. But don’t distress, new sites are pretty easy to add. So, raise a flag in Slack or GitHub Issues.\n\n### Supported Media URLs\n\nHere are the currently supported URLs and media types.\n\n#### Videos\n\n- https://example.com/video.mp4\n- https://example.com/video.avi\n- https://example.com/video.mov\n- https://example.com/video.ogv\n- https://example.com/video.webm\n- https://example.com/video.m4v\n- https://example.com/video.3gp\n- https://example.com/video.m3u8\n- https://vimeo.com/1234\n- https://www.youtube.com/watch?v=video-id\n- https://youtu.be/video-id\n- http://www.dailymotion.com/video/video-id_video-slug\n- https://twitter.com/Breaking911/status/900211169734131713\n- https://giphy.com/gifs/cat-funny-OrNbkY7oQOrh6\n\n#### Audios\n\n- https://example.com/audio.mp3\n- https://example.com/audio.aac\n- https://example.com/audio.wav\n- https://example.com/audio.ogg\n- https://example.com/audio.oga\n- https://example.com/audio.m4a\n\n#### Images\n\n- https://example.com/image.png\n- https://example.com/image.jpeg\n- https://example.com/image.jpg\n- https://example.com/image.gif\n- https://example.com/image.svg\n\n#### Tweets\n\n- https://twitter.com/veganstraightedge/status/854782420591165440\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/veganstraightedge/markdown_media. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n### Contributors\n\n* Shane Becker \u003cveganstraightedge@gmail.com\u003e\n* Morgan Fogarty \u003cmofo37@gmail.com\u003e\n* Matt Pruitt \u003cguitsaru@gmail.com\u003e\n* Justin Lavoie \u003cjust1602@riseup.net\u003e\n* astronaut-wannabe \u003ccontact@astronaut-wannabe.com\u003e\n\n## License\n\n**PUBLIC DOMAIN**\n\nYour heart is as free as the air you breathe. \u003cbr\u003e\nThe ground you stand on is liberated territory.\n\nIn legal text, *Markdown Media* is dedicated to the public domain\nusing Creative Commons — CC0 1.0 Universal.\n\n[http://creativecommons.org/publicdomain/zero/1.0](http://creativecommons.org/publicdomain/zero/1.0 \"Creative Commons — CC0 1.0 Universal\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveganstraightedge%2Fmarkdown_media","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fveganstraightedge%2Fmarkdown_media","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveganstraightedge%2Fmarkdown_media/lists"}