Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6030505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:02:47+00:00 2026-05-23T05:02:47+00:00

I am getting an unreliable result from the Tumblr API. When I get a

  • 0

I am getting an unreliable result from the Tumblr API. When I get a single line of text, I receive just the text. When there are multiple lines, each line is wrapped in a <p> tag. So I either get:

This is a value with no second line

or

<p>This is a value</p>
<p>with a second line</p>

I want both to appear the same. I have been manually adding the <p> around the value, but this will result in:

<p><p>This is a value</p>
<p>with a second line</p></p>

on multi-line values.

I have a few thoughts on how to fix this, but am unsure which would be the best.

  1. Create new CSS style p p {} such that offsets the screwed up styling
  2. Use jQuery to take DOM contents of redundant <p> tags and make them non-redundant
  3. Just load the text into a jQuery function, see if there are <p> tags, add them if not, then write the result into the DOM.

I’m not sure option 1 will work very well (particularly across browsers), and it seems a bit hacky. Any ideas on if either option 2 or 3 is better, and how I would implement?

Edit: Should’ve mentioned I’m playing with a Tumblr theme, so Python/PHP/ASP/etc are not available to me (that would make it easier for me!).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:02:48+00:00Added an answer on May 23, 2026 at 5:02 am

    Match it first:

    result = /^\s*\<p\>.+\<\/p\>$/.test(result) ? result : '<p>' + result + '</p>';
    

    Instead of just adding the tags all the time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a reliable way of getting access token errors from the facebook platform?
Just make and upgrade to rails 3.2 from 3.1.3. The activeadmin is not getting
Getting my head around Android, I've sort of trouble understanding support for multiple devices.
Getting the exception on this line: public bool isEngageOn() { line 149 -> return
Getting a background process ID is easy to do from the prompt by going:
Getting thrown into ColdFusion dev at work and just starting out, I wonder if
I have been getting unreliable results while trying to apply UIAppearance proxy styles to
I have bunch of data objects that I populate after getting data from a
Getting extremely confused with an adminhtml module i'm trying to write! Effectively I have
Getting message expected identifier in red for below these two statements } else if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.