Skip to content

How to parse additional markdown files? #2004

Closed
Closed
@Sayan751

Description

@Sayan751

Search terms

  • additional markdown
  • parsing
  • lexing
  • tokenization
  • reflection
  • plugin

Question

I have written a plugin that reads all the non-root/non-readme markdown files and creates HTML files out of those. Additionally it also supports some custom inline-tags. This process looks roughly as follows:

// The plugin code is abbreviated for the purpose of discussing the root issue.
function load(app) {
  app.renderer.on({
    [Renderer.EVENT_END_PAGE]: renderMarkdownPage.bind(app),
  });
}

function renderMarkdownPage(pageEvent) {
  if (!(model instanceof MarkdownReflection)) return; // <- MarkdownReflection: my custom reflection class

  pageEvent.contents = /** @type {DefaultTheme} */ (this.renderer.theme)
    .getRenderContext(pageEvent)
    .markdown(model.content) // <-- Markdown content
}

This works as expected except one problem. If the additional markdown files contain inline tags like {@link} those remain untouched and are not converted. So I thought to perform the same stuffs that is done for the project readme. However, I see that the relevant components are not exported from the package and additional exports are blocked via the exports in the package.json.

Is there any work around for this? Or am I looking at the wrong places, and there is a easier way to achieve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions