Coder Social home page Coder Social logo

Comments (5)

ssorallen avatar ssorallen commented on May 2, 2024

Related StackOverflow answers that explains why this happens: text nodeValue containing HTML entity

from react-magic.

ssorallen avatar ssorallen commented on May 2, 2024

The simplest approach might be to escape ampersands in text passed to the converter:

> converter.convert("<code>&amp;lt;body&amp;gt;</code>")
"<code>&lt;body&gt;</code>
"

from react-magic.

Daniel15 avatar Daniel15 commented on May 2, 2024

I used one weird trick to escape required symbols:

var tempEl = document.createElement('div');
function escapeSpecialChars(value) {
  // Uses this One Weird Trick to escape text - Raw text inserted as textContent
  // will have its escaped version in innerHTML.
  tempEl.textContent = value;
  return tempEl.innerHTML;
}

escapeSpecialCharacters('<'); // &lt;

Although I just realised this won't work exactly right in Node.js where I use JSDom, so I'll have to move stuff around a bit.

from react-magic.

ssorallen avatar ssorallen commented on May 2, 2024

The fix works great in browser.

Are the past couple fixes worthy of a minor version release or a patch release?

from react-magic.

Daniel15 avatar Daniel15 commented on May 2, 2024

Yeah I think I'll do a patch release, just want to wait a few days and see
if any other small bug fixes come up.

Regards,
Daniel Lo Nigro
http://dan.cx/ | Twitter http://twitter.com/Daniel15 | Facebook
http://www.facebook.com/daaniel

On Sat, Jan 10, 2015 at 12:13 PM, Ross Allen [email protected]
wrote:

The fix works great in browser.

Are the past couple fixes worthy of a minor version release or a patch
release?

Reply to this email directly or view it on GitHub
#11 (comment).

from react-magic.

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.