How to use the @uiengine/util.MarkdownUtil.fromFile function in @uiengine/util

To help you get started, we’ve selected a few @uiengine/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dennisreimann / uiengine / packages / core / src / component.js View on Github external
const { base, components } = state.config.source
  const configPath = componentIdToFilePath(components, id)
  const dir = dirname(configPath)
  const readmePath = join(dir, COMPONENT_DOCSNAME)
  const sourcePath = crossPlatformPath(relative(base, dir))
  const data = { attributes: {}, sourcePath }

  // config
  if (exists(configPath)) {
    data.attributes = requireUncached(configPath)
    data.sourceFile = crossPlatformPath(relative(base, configPath))
  }

  // readme
  if (exists(readmePath)) {
    data.content = await MarkdownUtil.fromFile(readmePath)
    data.readmeFile = crossPlatformPath(relative(base, readmePath))
  }

  debug4(state, `Component.readComponentFiles(${id}):end`)

  return data
}
github dennisreimann / uiengine / packages / core / src / page.js View on Github external
const configPath = pageIdToFilePath(pages, id)
  const dir = dirname(configPath)
  const readmePath = join(dir, PAGE_DOCSNAME)
  const sourcePath = crossPlatformPath(relative(base, dir))
  const data = { attributes: {}, sourcePath }

  // config
  if (exists(configPath)) {
    data.attributes = requireUncached(configPath)
    data.sourceFile = crossPlatformPath(relative(base, configPath))
  }

  // readme
  if (exists(readmePath)) {
    data.content = await MarkdownUtil.fromFile(readmePath)
    data.readmeFile = crossPlatformPath(relative(base, readmePath))
  }

  debug4(state, `Page.readPageFiles(${id}):end`)

  return data
}