diff --git a/src/MiniDocs/Markdown.class.st b/src/MiniDocs/Markdown.class.st index 804ed0d..40d5a73 100644 --- a/src/MiniDocs/Markdown.class.st +++ b/src/MiniDocs/Markdown.class.st @@ -159,12 +159,18 @@ Markdown >> fromFile: aFileReference [ { #category : #'instance creation' } Markdown >> fromString: markdownString [ - markdownString yamlMetadata + | yamlMetadataRaw bodyTemp | + yamlMetadataRaw := (YamlHeaderParser parse: markdownString). + bodyTemp := '' writeStream. + (yamlMetadataRaw removeKey: 'body') do: [:paragraph | + bodyTemp nextPutAll: paragraph; cr; cr + ]. + self body: bodyTemp contents withInternetLineEndings. + yamlMetadataRaw ifNotNil: [ self metadata - ifEmpty: [self metadata: markdownString yamlMetadata] - ifNotEmpty: [self metadata at: 'original' put: markdownString yamlMetadata]]. - self body: markdownString contentsWithoutYAMLMetadata + ifEmpty: [ self metadata: yamlMetadataRaw ] + ifNotEmpty: [ self metadata at: 'hedgeDoc' put: yamlMetadataRaw ]]. ] { #category : #accessing } diff --git a/src/MiniDocs/OrderedDictionary.extension.st b/src/MiniDocs/OrderedDictionary.extension.st index 28f7956..0ece656 100644 --- a/src/MiniDocs/OrderedDictionary.extension.st +++ b/src/MiniDocs/OrderedDictionary.extension.st @@ -62,6 +62,16 @@ OrderedDictionary >> replaceWithUniqueNilsAndBooleansStartingAt: anInteger [ ] ] +{ #category : #'*MiniDocs' } +OrderedDictionary >> sanitizeMultilineValuesWith: aString [ + | toSanitize | + toSanitize := OrderedCollection new. + self keysAndValuesDo: [:k :v | + (v isString and: [v lines size > 1]) ifTrue: [ toSanitize add: k ] + ]. + ^ toSanitize +] + { #category : #'*MiniDocs' } OrderedDictionary >> treeView [ | view |