question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

First I want to start by saying this library is fantastic, thanks for your work on it. Before using this lib, I tried regexes which ended up getting overly complex and slow. I’m happy to submit PRs for everything below, just wanted to talk through some of it through beforehand.

I noticed a few bugs so far…

  • PropTypes error from @bbob/react (#27).
  • reactPreset.extend doesn’t work, but presetHTML5.extend does (#29).
  • Warning: Each child in a list should have a unique "key" prop. with react (#30).
  • Uppercase tags cause issues in react (see below) (#34).
  • [*] tags inside lists don’t work in react.
  • I can help with some documentation (e.g. options, create a preset).

These ones are necessary, but would be nice to have…

  • Expose getUniqAttr from plugin-helpers so preset authors and consumers can use it.

Uppercase Tags

For example, something like [B] kind of works in the demo because most browsers will automatically recognize and lowercase it (at least in the inspector) so it will still be rendered. That said the styling attributes you’re adding with the b definition are lost and the demo only shows it bold because of default browser styling.

In react however, the following error is thrown:

<B /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.

To fix this issue, I simply injected a little preset before the main one to lowercase all tag names:

            plugins={[
                (tree, core) => {
                    tree.walk(node => {
                        if (typeof node === 'object' && node.tag) {
                            node.tag = node.tag.toLowerCase()
                        }

                        return node
                    })
                },
                preset()
            ]}

That works, but feels a little hacky so I’m thinking this probably makes sense as a built-in but I’m not sure where to put it.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
JiLiZARTcommented, Aug 11, 2019

I just published 2.5.3 you can try

1reaction
JiLiZARTcommented, Jun 29, 2019

Maybe I could apply the lowercase here ? I don’t know if there’s any other implications, but in my experience all bbcode tags should be fine lower-cased.

Yes, TagNode is a good way to lowercase tag.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use a few things in a sentence - Examples - Bab.la
How to use "a few things" in a sentence? ; few things to remember: ; few things to keep in mind: ; Here...
Read more >
Few thing definition and meaning | Collins English Dictionary
Few thing definition: You can use thing to refer to any object, feature , or event when you cannot, need not,... | Meaning,...
Read more >
JP Saxe – The Few Things Lyrics - Genius
The Few Things Lyrics: I don't say whats on my mind quite as much as you'd like me to / I've been hearing...
Read more >
Few Things synonyms - 136 Words and Phrases for Few Things
Another way to say Few Things? Synonyms for Few Things (other words and phrases for Few Things).
Read more >
There is/are a few things? - WordReference Forums
Hello everybody, What´s the correct option? There is a few things. There are a few things. If I had to choose, I would...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found