Skip to content

Commit 56902b7

Browse files
committed
update README
1 parent 4651567 commit 56902b7

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

README.md

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,26 @@
1-
# SwiftMathMarkdown
1+
# MathMarkdown
22

33
## Approaches
4-
- Study attributed-string-builder and migrate Markdownosaur visit code in.
5-
- Assemble multiple Markdown to AttributedString collection, review and compare differences later.
6-
- MarkupFormatter & MarkupTreeDumper uses MarkupWalker protocol
7-
- BreakDeleter (MarkupFormatter), SoftBreakDeleter both uses MarkupRewriter.
4+
- Use RegEx to preprocess Markdown text, and substitute math latex code that swift-markdown and cmark-gfm cannot handle by UUIDs.
5+
- Apply swift-markdown parsing on the substituted text.
6+
- Use MarkupWalker to extract the finalized list of network images, local images and math images that need to be generated.
7+
- Use Async/Await to handle SwiftMathImage and Image download
8+
- Embed Remote NSTextAttachment(iOS) and NSTextAttachmentCell(macOS) into NSAttributedString
9+
- Build using a Formatter on NSAttributedString for PDF generation.
10+
- Prepare for async notification to refresh NSTextAttachment or NSTextAttachmentCell.
811

9-
## Asynchronous Behaviour consideration
10-
- SwiftMathDownosaur could accept two closures, one to handle latex images generation, and the other local or remote images loading
11-
- These can be asynchronous loading effect, keeps changing the contents of the attributed string when contents arrives.
12-
- Each arrival or notification of the contents, triggers a textLayout refresh.
13-
- So far, no implementation approaches. May be a bit of Combine.
14-
15-
## Notes
16-
- Done apply change to Downosaur. AttributedStringBuilder seems complex.
17-
18-
## Limitations
12+
## Some Limitations
1913
- objcio.attributed-string-builder (supports cocoa only, uses TextBlock), adopt its MarkupWalker approach,
20-
- Markdownosaur uses only MarkupVisitor approach
2114
- NSAttributedString, paragraphStyle implementation is different across cocoa and uikit. The former has TextBlock for Table.
22-
- May need to lower the support on iOS.
23-
- All code uses struct on MarkupVisitor/MarkupWalker, thus cannot subclass and override.
15+
- struct based MarkupVisitor and MarkupWalkers cannot be subclassed.
16+
- NSImage, drawn using CoreGraphics preserves Glphy Infos while UIImage does not, end upwith awkward multi-line math equations across PDF pages.
2417

2518
## References
26-
- not depend on apple/swift-markdown https://github.com/objecthub/swift-markdownkit.git
19+
- This does not depend on apple/swift-markdown https://github.com/objecthub/swift-markdownkit.git
2720
- Renderer is publishing to SwiftUI only https://github.com/LiYanan2004/MarkdownView.git/Sources/MardownView/Renderer/Renderer.swift
28-
- Interesting library to configure view on Markdown visitor, https://github.com/johnxnguyen/Down.git
21+
- Other library to configure view on Markdown visitor, https://github.com/johnxnguyen/Down.git
2922
- Unfortunately, this only supports MacOS but not iOS. https://github.com/objcio/attributed-string-builder.git
3023
- apple/swift-docc/Sources/SwiftDocC/Model/Rendering/RenderContentCompiler use MarkupVisitor
31-
- https://github.com/nathantannar4/StyleKit.git read StyleKit/StyleKit/Font.swift on Bundle handling.
24+
- read StyleKit/StyleKit/Font.swift on Bundle handling https://github.com/nathantannar4/StyleKit.git .
3225
- This is mainly cgContext based rendering, not even covering pdf, https://github.com/shaps80/GraphicsRenderer/tree/master
3326
- Mainly for drawing stuff, use with GraphicsRenderer, https://github.com/shaps80/InkKit.git
34-
35-
## Sample inline math
36-
This is a sample `\sqrt{5z+6}-(9+y)^3` test.

0 commit comments

Comments
 (0)