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

Example doesn't seem to work #33

Closed
Krinkle opened this issue Dec 18, 2017 · 2 comments · Fixed by #34
Closed

Example doesn't seem to work #33

Krinkle opened this issue Dec 18, 2017 · 2 comments · Fixed by #34

Comments

@Krinkle
Copy link

Krinkle commented Dec 18, 2017

Steps to reproduce

Invoking the default docsSoap() function on Node 7 with jsdom and jsdom-global, with a string like <span style="font-weight:700">bold text</span><span style="font-style:italic">some italic text</span> appears to get returned as-is without transformation.

Expected behavior

I'd expect it to return <strong>some bold text</strong><i>some italic text</i> or <b>some bold text</b><i>some italic text</i>.

Code example or screenshot if applicable

Exact example from readme, at https://runkit.com/krinkle/5a383fead05daa0011f5ac4d.

require('jsdom');
require('jsdom-global')();
var docsSoap = require("docs-soap").default;

const html = '<body><b><span style="font-weight:700">bold text</span><span style="font-style:italic">some italic text</span></b></body>';
const clean = docsSoap(html);
console.log(clean);
// <body><b><span style="font-weight:700">bold text</span><span style="font-style:italic">some italic text</span></b></body>

More simplified, at https://runkit.com/embed/c1tdmaet1778

require('jsdom');
require('jsdom-global')();
var docsSoap = require("docs-soap").default;

const html = '<span style="font-weight:700">bold text</span><span style="font-style:italic">some italic text</span>';
const clean = docsSoap(html);
console.log(clean);
// <body><span style="font-weight:700">bold text</span><span style="font-style:italic">some italic text</span></body>

@aem I suspected this might be a Runkit or Node specific issue, but I experience the same on CodePen, in the browser. Paste at https://codepen.io/Krinkle/pen/vpLMaB

<script src="https://unpkg.com/docs-soap@1.1.0/dist/docs-soap.min.js"></script>
var docsSoap = window.docsSoap.default;
const html = '<body><b><span style="font-weight:700">bold text</span><span style="font-style:italic">some italic text</span></b></body>';
const clean = docsSoap(html);
console.log(clean);
// Expected: <body><strong>some bold text</strong><i>some italic text</i></body>
// Actual: <body><b><span style="font-weight:700">bold text</span><span style="font-style:italic">some italic text</span></b></body>
@aem
Copy link
Owner

aem commented Dec 19, 2017

Ah, this is my fault, the examples aren’t up to date. There was an issue in the past that this was being run on non-GDocs content and had unexpected effects so the library checks for a specific HTML docs GUID attribute, and if the attribute isn’t present it just returns the same markup, which is what you’re seeing. I can update the examples to work properly, but the library itself works as expected

@aem
Copy link
Owner

aem commented Jan 8, 2018

@Krinkle sorry for the delay on updating the docs. check #34 for updated examples/README

@aem aem closed this as completed in #34 Jan 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants