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

View File

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