Comment
Why HTML in Markdown doesn't work in codeberg?
Why HTML in Markdown doesn't work in codeberg?
What do you mean it does not work? Personally I have pieces of HTML in most of my project's READMEs and it works well
Example:
# MDHacks
<a href="https://nogithub.codeberg.page">
<img src="https://nogithub.codeberg.page/badge.svg" alt="Please don't upload to GitHub"></img>
</a>
<p>Fun markdown's hacks</p>
Hi, **MDHacks** is a repository that contain multiple & only markdown hacks!
For example, here it's a markdown hack:
<p id="body" type="text/html" style="font-weight:bold;font-style:italic;background-color:green;color:lightgreen;">
This is a markdown's hack.
</p>
## FAQ
❓How that works?
💡This works using **HTML, CSS** & pottentialy **JavaScript** because it's compactible with **Markdown**.
❓How to made this?
💡 To create your own markdown's hack, you need to make a HTML & CSS like...
`<p id="body" type="text/html" style="font-wegith:bold;font-style:italic;background:green;color:lightgreen;>Your text</p>`. For informations, always start a paragraph with `<p id="body" type="text/html" style="opacity: 0%;">AAAAAA</p>` as the document body.
Or another, you cannot use the `<style>` tag in **Markdown**, but in place, use the `style` argument inside your element.
More informations at https://codeberg.org/therealneca7/mdhacks.
Yes, CSS and JS can't be injected because of the server CSP headers if I'm correct. It would open a huge attack surface otherwise.
Why that will open a huge attack surface?
@therealneca7 wrote in #1886 (comment):
Why that will open a huge attack surface?
Well, if you can include custom scripts in your markdown files, this means that you can execute arbitrary code in the browser of anyone visiting the page that renders your markdown file (which is precisely what CSP aims to prevent).
Similarly, if CSS is allowed outside of inline definitions, it is possible to completely break the layout of the page, since you can define CSS rules for body or other HTML elements.
kind, a markdown file that inject HyperText Markup Language, Cascading Style Sheets and JavaScript, which makes a custom page in the even website, even subdomain, even link?
You can edit a custom page (i.e. codeberg.page) any way you want, but you can't do whatever you like with the md render inside codeberg.org. And yes you can have a custom page, even subdomain with a custom domain. see https://docs.codeberg.org/codeberg-pages/using-custom-domain/
no kind in https://codeberg.org/example-user/example-repo (thats a example account & example repository created by me) and the README.md injects HTML, CSS & JavaScript. It is possible?
@therealneca7 wrote in #1886 (comment):
no kind in https://codeberg.org/example-user/example-repo (thats a example account & example repository created by me) and the
README.mdinjects HTML, CSS & JavaScript. It is possible?
I don't think so. You can, of course, use inline style definitions, but more than that would cause many security concerns, as explained here. For instance, imagine, if you had the following line in your README.md:
<style>
body {
display: none !important;
}
</style>
It would make the whole page disappear every time someone clicks on your repository! And you could do much more damage by injecting JavaScript, since it would execute actual code every time the page that renders your README is loaded.
With JS injection, you could get user cookies, ouath, mining cryptocurrency, etc. so yes as @camelia said, not a good idea. If you want all of that use Codeberg's page https://codeberg.page/
Okay. I will close this issue now.
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?