I want to write a reader for multiple lightweight markup languages. It must only support pretty basic “rich text” features (bold, indent, lists, such things), complicated formatting and not-matching tags will be entirely ignored.

I don’t want to use a intermediate file like pandoc does, since it should not convert but only display.
Which is why i thought of using a “mapping file” for each language. Guess it should support hierarchies, since formats like Markdown require context (prior line has this and next line that), so it will likely be in YAML/TOML/JSON.

Is this sufficient, or is there any better approach for simple addition of markup languages?
Or other projects doing similiar, i could learn from?

The context is a simple mbox/eml reader for a start (html and markdown), and the experience/ideas will be used in a bigger project later, with more language support.

  • e0qdk@reddthat.com
    link
    fedilink
    arrow-up
    1
    ·
    7 days ago

    Are you trying to write your own parsers for these formats or something like that? I don’t think I really get the issue you’re running into.

    If you want to just display formatted text (esp. including HTML), you can use a browser (either as an embedded widget in a custom app, via an Electron app, or in a regular browser via an HTTP server) and generate the output on the fly. You don’t need to save the converted output if it’s fast enough to generate…

    • MonkderVierte@lemmy.zipOP
      link
      fedilink
      arrow-up
      1
      ·
      7 days ago

      Are you trying to write your own parsers for these formats

      Yes, but it should be easy to add support for other markup languages. Hence the mapping file. Since it’s not complex formatting, that should suffice, i think?

      No, not in a browser or electron or similiar. It should be lightweight and quick to launch on any device.

      I rephrased the post a bit.