From 9744a8c6b03d5dc74df97e53d3a78953bd007761 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 10 Mar 2024 19:29:19 -0500 Subject: [PATCH] Markdown YAML metadata and default options. --- src/MiniDocs/Markdown.class.st | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/MiniDocs/Markdown.class.st b/src/MiniDocs/Markdown.class.st index 24be866..a50e674 100644 --- a/src/MiniDocs/Markdown.class.st +++ b/src/MiniDocs/Markdown.class.st @@ -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 |