Microdown
Microdown copied to clipboard
I do not get the implementation of asHTMLDocument:
There are two implementations
MicHTMLVisitor>>asHTMLDocument: aMicrodownString
"Answer a <String> formatted as HTML with UTF-8 encoding from aMicrodownString as input"
^ self new convertMicStringToDoc: aMicrodownString
and
Microdown>> asHTMLDocument: aStringOrDoc
"Facade method to serialize a Microdown document or string to HTML"
^ MicHTMLVisitor serializeToHTMLDoc: aStringOrDoc.
```
The API of MicHTMLVisitor is really suboptimal. There is no simple paths between
serializeToHTMLDoc: aMicrodownString withStyle: aStyleName
"Serialize aMicrodownString <String> to a HTML file with CSS style named aStyleName and default for output directory and file name"
MicHTMLDocument new
addCSSNamed: aStyleName;
fromMicrodown: aMicrodownString;
writeToFile
and
asHTMLString: aMicrodownString configuration: aMicHTMLConfiguration
"Answer a <String> formatted as HTML from aMicrodownString as input"
^ self new
configuration: aMicHTMLConfiguration;
convertMicString: aMicrodownString
OK serializeToHTMLDoc: uses asHTMLString: in
fromMicrodown: aMicrodownString
"Convert to HTML and wrap aMicrodownString in the receiver's HTML stream"
self initializeCanvas.
self writeDocument: (Microdown
asHTMLString: aMicrodownString
configuration: self configuration)
It feels that serializeToHTMLDoc: aMicrodownString withStyle: aStyleName should be defined on MicHTMLDocument.
I wonder if HTMLDocument should not directly refers to the MicHTMLVisitor instead of going to the Facade because MicHTMLDocument cannot work without the MicHTMLVIsitor