Markdown YAML metadata and default options.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-03-10 19:29:19 -05:00
parent 4c661e0b6d
commit 9744a8c6b0
1 changed files with 12 additions and 1 deletions

View File

@ -87,6 +87,12 @@ Markdown >> contentsWithoutYAMLMetadata [
^ newContents contents.
]
{ #category : #accessing }
Markdown >> defaultOptions [
^ { 'sourceCodeLink' -> true .
'commentsProvider' -> 'Hypothesis' } asDictionary
]
{ #category : #operation }
Markdown >> deleteYAMLMetadata [
| newContents |
@ -212,7 +218,7 @@ Markdown >> metadata: rawMeta [
{ #category : #accessing }
Markdown >> metadataAsYAML [
self metadata isEmptyOrNil ifTrue: [ ^ self ].
self metadata isEmptyOrNil ifTrue: [ ^ '' ].
^ YQ jsonToYaml: self metadata
]
@ -223,6 +229,11 @@ Markdown >> notifyExportAsFileOn: aFileReference [
^ aFileReference
]
{ #category : #accessing }
Markdown >> options [
^ self metadata at: 'options' ifAbsentPut: [ self defaultOptions]
]
{ #category : #accessing }
Markdown >> populateMetadata [
| rawMeta |