Giter VIP home page Giter VIP logo

Comments (7)

deer avatar deer commented on May 18, 2024

Again it would be great if you could provide more details. In this particular case about the current output and the expected output.

Although to keep things short, I guess you want to do something like this:

  const body = render(
    `# Hello, world!
<ul style="list-style-type: '&#x1F514; ';">
    <li>item</li>
    <li>item</li>
    <li>item</li>
</ul>

- Normal list
- Normal list
- Normal list
`,
    { allowedAttributes: { ul: ["style"] } },
  );

from deno-gfm.

deer avatar deer commented on May 18, 2024

Please close this if using allowedAttributes solves your problem.

from deno-gfm.

ooker777 avatar ooker777 commented on May 18, 2024

It looks promising, but not working on my machine. The full code:

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

const body = render(
  `# Hello, world!
<ul style="list-style-type: '&#x1F514; ';">
  <li>item</li>
  <li>item</li>
  <li>item</li>
</ul>

- Normal list
- Normal list
- Normal list
`,
  { allowedAttributes: { ul: ["style"] } },
);

export default function a() {
  return <main dangerouslySetInnerHTML={{ __html: body }}>
  {body}
  </main>
} 

There is an error at allowedAttributes: Object literal may only specify known properties, and 'allowedAttributes' does not exist in type 'RenderOptions'.deno-ts(2353)

from deno-gfm.

deer avatar deer commented on May 18, 2024

It's always a good idea to be explicit about versions. You likely have an old version cached. Try specifying the version like this: https://deno.land/x/[email protected]/mod.ts

from deno-gfm.

ooker777 avatar ooker777 commented on May 18, 2024

I see. I thought that if you don't specify the version, the runtime will check if the cache is already in the latest version or not. I also notice that the allowedAttributes option is only introduced at 0.6.0. However the release note doesn't note this. Is this normal?

from deno-gfm.

deer avatar deer commented on May 18, 2024

Blindly using the latest version can be, at worst, a huge security vulnerability and, slightly less bad, can sometimes cause your code to break. I can't really imagine a case where always using the latest is desired.

As for the caching issue, I guess if you had reran your code with -r it would have reloaded the dependencies.

For the release notes, most projects just take a list of all the PRs that have been merged. You can see I'm there:

feat: custom tags and attributes by @deer in #95

What more are you expecting?

from deno-gfm.

ooker777 avatar ooker777 commented on May 18, 2024

I see. Thanks for your help

from deno-gfm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.