denoland / deno_blog

Minimal boilerplate blogging.
MIT License
477 stars 100 forks source link

disable_html_sanitization not working #119

Closed capogreco closed 11 months ago

capogreco commented 1 year ago

markdown file looks like this:

---
title: Hello world!
publish_date: 2023-03-09
disable_html_sanitization: true
---

This is my first blog post!

<iframe src="https://editor.p5js.org/capogreco/full/lqJs887v-"></iframe>

Which should show an embed of one of my p5 sketches. Alas, it looks like this:

Screenshot 2023-03-09 at 10 06 49 pm

ie. the iframe was sanitized out. Am I doing something wrong, or is disable_html_sanitization not working?

hashrock commented 1 year ago

hmm, I'm not familiar with html sanitization, but it could be a problem on the deno_gfm side.

import { render } from "https://deno.land/x/gfm/mod.ts";

const html = `<div><wiggly worms="ewww">hello</wiggly>world</div>`
const body = render(html, {
  disableHtmlSanitization: true,
});

console.log(body)
// -> <div>helloworld</div>
lino-levan commented 1 year ago

This is because /x/blog has not released a tag since last September. I will create a PR with the necessary changes to create a new tag. Hopefully #118 gets merged alongside it since that seems like a nice feature.

lino-levan commented 1 year ago

To get around the tag issue now, you could always change your import map to:

{
  "imports": {
    "blog": "https://raw.githubusercontent.com/denoland/deno_blog/main/blog.tsx"
  }
}
lino-levan commented 1 year ago

By the way, @hashrock I can't reproduce your example

import { render } from "https://deno.land/x/gfm@0.2.1/mod.ts";

const html = `<div><wiggly worms="ewww">hello</wiggly>world</div>`
const body = render(html, {
  disableHtmlSanitization: true,
});

console.log(body) // <div><wiggly worms="ewww">hello</wiggly>world</div>
lino-levan commented 1 year ago

ref #120

capogreco commented 1 year ago

To get around the tag issue now, you could always change your import map to:

{
  "imports": {
    "blog": "https://raw.githubusercontent.com/denoland/deno_blog/main/blog.tsx"
  }
}

incredible - many thanks @lino-levan !!

hashrock commented 1 year ago

@lino-levan

Oh, you are right. I couldn't reproduce it anymore. I guess my cache was old.

lino-levan commented 11 months ago

Should this issue be closed?