Skip to content

Configuring numberOfLines for the whole markdown #244

@gregoripolak

Description

@gregoripolak

Issue Description

Hello, I am working on integrating the react-native-markdown-display into our application to display Markdown content. We have a global requirement to limit the number of visible lines across all Markdown-rendered content. Currently, I see that we can apply styles or rules to individual Markdown elements, but there does not seem to be a way to set a maxNumberOfLines for the entire content block universally.

Expected Behavior

I would like to be able to pass a numberOfLines prop to the Markdown component that applies this limit to the entire content, not just specific elements. Here's a conceptual API I am looking for:

const ContentViewer = ({ content, numberOfLines }) => {
  return <Markdown style={styles} numberOfLines={numberOfLines}>
    {content}
  </Markdown>;
};

Current Behavior

Currently, the library allows styling individual elements, but applying a global numberOfLines restriction requires custom implementation for each element type.

Environment

Package Version: 7.0.2
React Native Version: 0.74.3
Platform: iOS & Android

Question

Is there a workaround or potential update that could support this feature? If not, could this be considered for a future release? Any guidance or suggestions on how I might implement this feature myself would also be greatly appreciated.

Thank you for your work on this package and for considering this feature request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions