<commit_before>import { Flex, Sans, Serif } from "@artsy/palette"
import { plainTextFromTree } from "lib/utils/plainTextFromTree"
import { defaultRules, renderMarkdown } from "lib/utils/renderMarkdown"
import { Schema } from "lib/utils/track"
import _ from "lodash"
import React, { useState } from "react"
import { Text } from "react-native"
import { useTracking } from "react-tracking"
import { LinkText } from "./Text/LinkText"

interface Props {
  content: string
  maxChars: number
  presentLinksModally?: boolean
  contextModule?: string
  trackingFlow?: string
}

export const ReadMore = React.memo(({ content, maxChars, presentLinksModally, trackingFlow, contextModule }: Props) => {
  const [isExpanded, setIsExpanded] = useState(false)
  const tracking = useTracking()
  const basicRules = defaultRules(presentLinksModally)
  const rules = {
    ...basicRules,
    paragraph: {
      ...basicRules.paragraph,
      react: (node, output, state) => {
        return (
          <Serif size="3t" color="black100" key={state.key}>
            {output(node.content, state)}
          </Serif>
        )
      },
    },
  }
  const root = renderMarkdown(content, rules)
  // Removes the last empty space in the markdown array
  if (Array.isArray(root)) {
    while (root.length && root[root.length - 1] && root[root.length - 1].type === Text) {<commit_msg>Uses em dash for line breaks when not expanded<commit_after>import { Flex, Sans, Serif } from "@artsy/palette"
import { plainTextFromTree } from "lib/utils/plainTextFromTree"
import { defaultRules, renderMarkdown } from "lib/utils/renderMarkdown"
import { Schema } from "lib/utils/track"
import _ from "lodash"
import React, { useState } from "react"
import { Text } from "react-native"
import { useTracking } from "react-tracking"
import { LinkText } from "./Text/LinkText"

interface Props {
  content: string
  maxChars: number
  presentLinksModally?: boolean
  contextModule?: string
  trackingFlow?: string
}

export const ReadMore = React.memo(({ content, maxChars, presentLinksModally, trackingFlow, contextModule }: Props) => {
  const [isExpanded, setIsExpanded] = useState(false)
  const tracking = useTracking()
  const basicRules = defaultRules(presentLinksModally)
  const rules = {
    ...basicRules,
    paragraph: {
      ...basicRules.paragraph,
      react: (node, output, state) => {
        return (
          <Serif size="3t" color="black100" key={state.key}>
            {output(node.content, state)}
            {isExpanded ? null : "⁠ — "}
          </Serif>
        )
      },
    },
  }
  const root = renderMarkdown(content, rules)
  // Removes the last empty space in the markdown array
  if (Array.isArray(root)) {
    while (root.length && root[root.length - 1] && root[root.length - 1].type === Text) {
{'fraction_non_alphanumeric': 0.12607449856733524, 'fraction_numerical': 0.004297994269340974, 'mean_word_length': 3.5048387096774194, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2207785', 'n_tokens_mistral': 860, 'n_tokens_neox': 846, 'n_words': 232}