diff --git a/src/Markdeep/LePage.extension.st b/src/Markdeep/LePage.extension.st new file mode 100644 index 0000000..b1d29b1 --- /dev/null +++ b/src/Markdeep/LePage.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #LePage } + +{ #category : #'*Markdeep' } +LePage >> markdeepFileName [ + | sanitized | + sanitized := self title asDashedLowercase copyWithoutAll: #($/). + ^ sanitized, '--',(self uidString copyFrom: 1 to: 5), '.md.html'. +] diff --git a/src/Markdeep/LeSnippet.extension.st b/src/Markdeep/LeSnippet.extension.st new file mode 100644 index 0000000..a14bb87 --- /dev/null +++ b/src/Markdeep/LeSnippet.extension.st @@ -0,0 +1,12 @@ +Extension { #name : #LeSnippet } + +{ #category : #'*Markdeep' } +LeSnippet class >> fromMetaMarkdeep: div [ + | className metadata snippet | + className := (div xpath: '@st-class') stringValue. + metadata := STON fromString:(div xpath: '@st-data') stringValue. + snippet := className asClass new. + snippet injectMetadataFrom: metadata. + snippet contentFrom: div. + ^ snippet. +] diff --git a/src/Markdeep/LeTextualSnippet.extension.st b/src/Markdeep/LeTextualSnippet.extension.st new file mode 100644 index 0000000..92c7eca --- /dev/null +++ b/src/Markdeep/LeTextualSnippet.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #LeTextualSnippet } + +{ #category : #'*Markdeep' } +LeTextualSnippet >> markdeepCustomCloser [ + ^ '' +] + +{ #category : #'*Markdeep' } +LeTextualSnippet >> markdeepCustomOpener [ + ^ '' +] diff --git a/src/Markdeep/Markdeep.class.st b/src/Markdeep/Markdeep.class.st index 47b8a32..ce16987 100644 --- a/src/Markdeep/Markdeep.class.st +++ b/src/Markdeep/Markdeep.class.st @@ -7,14 +7,14 @@ Class { #instVars : [ 'title', 'body', - 'tocStyle', 'comments', 'tail', 'language', 'config', 'metadata', 'head', - 'navTop' + 'navTop', + 'options' ], #category : #Markdeep } @@ -238,6 +238,19 @@ Markdeep >> navTop: aString [ navTop:= aString. ] +{ #category : #accessing } +Markdeep >> options [ + ^ options ifNil: [ + "Setting defaults accoding to: https://casual-effects.com/markdeep/#api" + options := Dictionary new + at: 'mode' put: nil; + at: 'lang' put: nil; + at: 'tocStyle' put: 'auto'; + at: 'autoLinkImages' put: true; + yourself + ] +] + { #category : #printing } Markdeep >> printOn: aStream [ @@ -288,12 +301,13 @@ Markdeep >> title: anObject [ { #category : #accessing } Markdeep >> tocStyle [ - ^ tocStyle ifNil: [ tocStyle := 'short' ] + ^ self options at: 'tocStyle' ifAbsent: [ 'short' ] ] { #category : #accessing } -Markdeep >> tocStyle: anObject [ - tocStyle := anObject +Markdeep >> tocStyle: aString [ + "A string can be: 'auto' 'none' 'short' 'medium' or 'long'" + self options at: 'tocStyle' put: aString ] { #category : #'instance creation' }