Giter Club home page Giter Club logo

Comments (3)

KillyMXI avatar KillyMXI commented on August 17, 2024 1

I was able to reproduce the error by passing an object instead of a string where selector string is expected.

Check the actual config you're passing.

from node-html-to-text.

KillyMXI avatar KillyMXI commented on August 17, 2024

It would've been more helpful if you followed the Bug Report template. (Opening an underprepared issue is inconsiderate to maintainers because it requires more effort to decipher.)

I've no idea what is "the public Canvas LMS guides", but it most likely doesn't matter here.

If the code was working before and doesn't work now - one of obvious things to check - package versions used now and then.

I see you trying to do something possibly not intended, by providing very narrow selectors for baseElements, as if the page title is the only thing, you're interested in. In that case you might not need html-to-text...

I can't reproduce the issue on the latest version with just the options provided.

const html = '<h1 class="PageTitle">Pick me</h1><div>ignore me</div>';
const simpleSelectors = ['h1.PageTitle'];
const selectorSpecs = [{ selector: 'h1.PageTitle', format: 'heading', options: { uppercase: false } }];
const text = convert(
  html,
  { baseElements: { selectors: simpleSelectors }, selectors: selectorSpecs }
);
console.log(text);

- this just works and outputs Pick me.

Stack trace gives me an idea what to fix in upstream package to prevent an error in error reporting, but not the actual cause.

Error in the stack trace most likely happened not with the options provided.

You have to put more effort on your side and make sure you are running what you think you are running.

from node-html-to-text.

pgoldweic avatar pgoldweic commented on August 17, 2024

oh, I see. That makes sense, as I was just going over that section and I think I was able to get it to work by probably doing what you're suggesting. Thanks for checking!

from node-html-to-text.

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.