Skip to content

petersktang/MathMarkdown

Repository files navigation

MathMarkdown

Approaches

  • Use RegEx to preprocess Markdown text, and substitute math latex code that swift-markdown and cmark-gfm cannot handle by UUIDs.
  • Apply swift-markdown parsing on the substituted text.
  • Use MarkupWalker to extract the finalized list of network images, local images and math images that need to be generated.
  • Use Async/Await to handle SwiftMathImage and Image download
  • Embed Remote NSTextAttachment(iOS) and NSTextAttachmentCell(macOS) into NSAttributedString
  • Build using a Formatter on NSAttributedString for PDF generation.
  • Prepare for async notification to refresh NSTextAttachment or NSTextAttachmentCell.

Some Limitations

  • objcio.attributed-string-builder (supports cocoa only, uses TextBlock), adopt its MarkupWalker approach,
  • NSAttributedString, paragraphStyle implementation is different across cocoa and uikit. The former has TextBlock for Table.
  • struct based MarkupVisitor and MarkupWalkers cannot be subclassed.
  • NSImage, drawn using CoreGraphics preserves Glphy Infos while UIImage does not, end upwith awkward multi-line math equations across PDF pages.

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages