" I model a Mardeep file as described in https://casual-effects.com/markdeep/ " Class { #name : #Markdeep, #superclass : #Object, #instVars : [ 'tocStyle', 'comments', 'header', 'tail', 'body', 'language', 'markdownFile', 'config', 'title' ], #category : #'Grafoscopio-Utils-Core' } { #category : #'as yet unclassified' } Markdeep class >> fromMarkdownFile: aFileReference [ ^ self new fromMarkdownFile: aFileReference. ] { #category : #accessing } Markdeep >> body [ ^ body ] { #category : #accessing } Markdeep >> body: anObject [ body := anObject ] { #category : #accessing } Markdeep >> comments [ ^ comments ifNil: [ ^ comments := true ] ] { #category : #accessing } Markdeep >> comments: aBoolean [ "I tell if comments are enabled by default or not." comments := aBoolean ] { #category : #utilities } Markdeep >> commentsProvider [ "I return the url of the default service that provides annotation support. I am used to add such support in the contents of the Markdeep page." ^ 'https://hypothes.is' ] { #category : #utilities } Markdeep >> commentsProviderStrings [ "I associate a comments service provider with the string that is required to be added to the document to enable such provider." | providers | providers := Dictionary new. providers at: 'https://hypothes.is' put: ' '. ^ providers ] { #category : #utilities } Markdeep >> commentsSupport [ "I enable comments of the page." self comments ifFalse: [ ^ self ]. ^ self commentsProviderStrings at: self commentsProvider ] { #category : #'instance creation' } Markdeep >> contents [ | output | output := '' writeStream. output nextPutAll: self header; crlf; nextPutAll: self body; crlf; nextPutAll: self tail; crlf; crlf; nextPutAll: self commentsSupport. ^ output contents. ] { #category : #persistence } Markdeep >> exportAsFile [ | newFile | self markdownFile ifNil: [ self inform: 'Define an input Markdown file or use #exportAsFileOn: instead.' ]. newFile := (self markdownFile fullName, '.html') asFileReference. self exportAsFileOn: newFile. ] { #category : #persistence } Markdeep >> exportAsFileOn: aFileReference [ aFileReference exists ifFalse: [ aFileReference ensureCreateFile ]. aFileReference writeStreamDo: [ :stream | stream nextPutAll: self contents ]. self inform: 'Exported as: ', String cr, aFileReference fullName ] { #category : #utilities } Markdeep >> fontAwesomeHeader [ "I enable the font awesome support in the document header" ^ ' ' ] { #category : #'instance creation' } Markdeep >> fromMarkdownFile: aFileReference [ "I create a Markdeep document from a given Markdown file." self processMarkdownFor: aFileReference. ^ self. ] { #category : #accessing } Markdeep >> header [ ^ self fontAwesomeHeader ] { #category : #accessing } Markdeep >> header: anObject [ header := anObject ] { #category : #accessing } Markdeep >> language [ ^ language ] { #category : #accessing } Markdeep >> language: anObject [ language := anObject ] { #category : #accessing } Markdeep >> markdownFile [ ^ markdownFile ] { #category : #accessing } Markdeep >> markdownFile: aFileReference [ "I provide information about which Markdown file was used to generate the Markdeep body" markdownFile := aFileReference ] { #category : #'instance creation' } Markdeep >> processMarkdownFor: aFileReference [ "comment stating purpose of message" | markdownContent | self markdownFile: aFileReference. markdownContent := Markdown fromFile: aFileReference. self body: (markdownContent commentYAMLMetadata contents). ] { #category : #accessing } Markdeep >> tail [ "I enable the document tail, which, in turn, enables a Markdeep document" ^ ' ' ] { #category : #accessing } Markdeep >> tail: anObject [ tail := anObject ] { #category : #accessing } Markdeep >> tocStyle [ ^ tocStyle ] { #category : #accessing } Markdeep >> tocStyle: anObject [ tocStyle := anObject ]