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 6328623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:29:34+00:00 2026-05-24T17:29:34+00:00

I would like to allow only paragraphs and lists. Actually i want to use

  • 0

I would like to allow only paragraphs and lists.

Actually i want to use the input to create a document in Open Document format. So I replace the tag <p> with the correct tag in ODF. But first, I’m trying to learn how to transform the markdown format into something I can use.

I could use the output of MarkdownPHP and replace tags in html to ODF tags, however i want to use only the paragraphs and lists. The Markdown generates much more than i need. If i miss any html tag the ODF document will break because it don’t understand html tags.

I believe it is possible to use a simple RegExp. But I don’t know how!

example:

My first line.

*    My first item.
*    My second item.

More text...

output:

<p>My first line.</p>
<ul>
    <li>My first item.</li>
    <li>My second item.</li>
</ul>
<p>More text...</p>
  • 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-24T17:29:35+00:00Added an answer on May 24, 2026 at 5:29 pm

    You can use the strip_tags() function to remove all tags other than the ones you want. Their contents will remain, but the tags themselves will be removed.

    Try this:

    $output = strip_tags($output, "<p><ul><ol><li>");
    

    From there, you can just use str_replace() to change the remaining tags into their ODF counterparts. (If the tag format isn’t consistent coming out of your Markdown parser, then you can just use preg_replace() to handle the differences depending on the specific output).

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

Sidebar

Related Questions

I have an EditText input that I would like to only allow numbers 1
I would like to validate the user input field to only allow user to
I would like to allow only one country access, but exclude proxies within this
I would like to allow only mobile devices on my web site, such as
I would like to make my website to allow only one session at a
I would like to use a slider that only allows round numbers. So for
I would like to only allow certain validations within production vs other environments for
I have a UITextView and I would like to only allow it to be
When deleting rows in a certain table, I would like to only allow the
I have some checkboxes and I would like to allow multiple selections, only that

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.