Skip to content
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

Support <video> tags on the Documentation #2431

Open
nihey opened this issue Oct 17, 2023 · 2 comments
Open

Support <video> tags on the Documentation #2431

nihey opened this issue Oct 17, 2023 · 2 comments
Labels

Comments

@nihey
Copy link

nihey commented Oct 17, 2023

Context

We are starting to use Elements as a Documentation tool and we needed the support to add videos on the Documentation description.

Current Behavior

Currently the video tags are sanitized out of the Markdown so they never appear on the final

Expected Behavior

Video tags would work just like other HTML tags on the documentation

Possible Solution(s)

I've checked your code and it is possible to do it by changing https://www.npmjs.com/package/@stoplight/markdown-viewer (which does not seem to be Open Source).

I would be willing to contribute if the repository was open, the change I've made to workaround it was:

// Change the file: node_modules/@stoplight/markdown-viewer/index.mjs
sanitizationSchema = deepmerge(defaultSchema, {^M
    tagNames: ['tabs', 'tab', 'codegroup', 'button', 'video', 'source'],
    attributes: {
        '*': ['className', 'style', 'id'],
        code: ['title', 'lineNumbers', 'inline', 'highlightLines', 'lang', 'live', 'jsonSchema', 'http', 'resolved'],
        img: ['bg', 'focus', 'inline', 'invertOnDark'],
        blockquote: ['theme'],
        video: ['src', 'controls'],
        source: ['src'],
    },
});

The rebuild the project and serve the files from my rebuilt version.

Example with videos: https://videomatik-editor-git-redoc-kassellabs.vercel.app/#/

@chohmann chohmann added the enhancement New feature or request label Nov 3, 2023
@chohmann
Copy link
Contributor

chohmann commented Nov 3, 2023

place in markdown viewer to update: https://github.com/stoplightio/markdown-viewer/blob/master/src/utils/parse.ts

@RanolP
Copy link

RanolP commented Mar 1, 2024

imho giving users control over what nodes should be kept is also a good solution. e.g. the doc author trying to use custom elements for icons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants