-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added video renderer for the image/link style #675
Conversation
Image images are there, why not videos? |
This looks useful, although I'm not sure about the default |
The video element can be very tricky due to sources for audio, captions, and so on. Not sure if defined in any of the targeted specifications (see #956). Closing for now to focus on fixing known issues based on targeted specifications. |
Would it be currently feasible to include videos as
And let the (custom) image renderer take care of generating the correct HTML tags for videos when a video file extension in the |
My two cents?? Not sure. https://www.w3.org/TR/html52/grouping-content.html#the-figure-element - has content model |
What has this to do with my question? |
Fair question. Not sure. Maybe nothing. From a pure HTML perspective, the two elements are not similar enough, imo. However, if Marked allows users to jump into the middle - then it may be possible without modification. Were you recommending implementing an extension like that? Or, something else? Seemed like you were saying Marked is already capable of doing this (hence the "not sure" part in the previous comment). |
Still feels like a hack when we take into consideration accessibility things like captioning and whatnot - things the In other words, can't think of a decent way for Markdown to generate something like the following: https://www.w3.org/TR/html51/semantics-embedded-content.html#the-video-element
The only way to achieve WCAG 2.0 Level A (lowest level) is to provide text-based alternatives to non-text content (this is why the At which point, videos seem more like the place for mixed content HTML + Markdown - not Markdown alone, because the beauty of Markdown is in defining a document, not necessarily a multimedia document with audio or video, imho. |
I needed this patch to serve video content through Contentful. The code, as is, didn't work for me. I had to change to I also changed the default autoplay and loop options. Seems to me like some of this code generation would need to be user-configurable for it to work well across most people's use cases. |
@gazreese that is imo a much better solution. This pull request is 2 years old. So use at own risk. Perhaps you could commit your changes? As @joshbruce said, the |
This is not likely to get implemented in marked.js until it becomes standard. This can be done easily by extending the marked.js renderer: var marked = require('marked');
var renderer = new marked.Renderer();
renderer.oldImage = renderer.image;
renderer.image = function (href, title, text) {
var videos = ['webm', 'mp4', 'mov'];
var filetype = href.split('.')[1];
if (videos.indexOf(filetype) > -1) {
var out = '<video autoplay loop alt="' + text + '">'
+ ' <source src="' + href + '" type="video/' + filetype + '">'
+ '</video>'
return out;
} else {
return renderer.oldImage(href, title, text);
}
};
console.log(marked('', { renderer: renderer })); I'm hoping in the future to have marked.js just follow the standard and have lots of little add-ons that add this sort of functionality. |
Perfect. Like a plug-in. I like it
Op do 26 jul. 2018 om 17:26 schreef Tony Brix <notifications@github.com>
This is not likely to get implemented in marked.js until it becomes
standard.
This can be done easily by extending the marked.js renderer:
var marked = require('marked');
var renderer = new marked.Renderer();
renderer.oldImage = renderer.image;
renderer.image = function (href, title, text) {
var videos = ['webm', 'mp4', 'mov'];
var filetype = href.split('.')[1];
if (videos.indexOf(filetype) > -1) {
var out = '<video autoplay loop alt="' + text + '">'
+ ' <source src="' + href + '" type="video/' + filetype + '">'
+ '</video>'
return out;
} else {
return renderer.oldImage(href, title, text);
}
};
console.log(marked('', { renderer: renderer }));
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#675 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAJySIONEic_9BsrEhd3w1DaBBXLW5qZks5uKd-HgaJpZM4GgH0p>
.
--
pgp public key: https://keybase.io/fritzvd/key.asc
|
After looking around a bit I didn't see a MD compiler with video support. Because I like to use remark for my presentations, I thought I'd add this renderer.
If no one's interested, or it doesn't fit in with the rest that's fine too 👍