diff --git a/src/MiniDocs/HedgeDoc.class.st b/src/MiniDocs/HedgeDoc.class.st index fded226..68df84e 100644 --- a/src/MiniDocs/HedgeDoc.class.st +++ b/src/MiniDocs/HedgeDoc.class.st @@ -55,13 +55,6 @@ HedgeDoc >> defaultServer [ self server: 'https://docutopia.tupale.co'. ] -{ #category : #accessing } -HedgeDoc >> documentTree [ - | parser| - parser := PPCommonMarkBlockParser new parse: self contents. - ^ parser accept: CMBlockVisitor new -] - { #category : #'as yet unclassified' } HedgeDoc >> htmlUrl [ | link | diff --git a/src/MiniDocs/Markdeep.class.st b/src/MiniDocs/Markdeep.class.st index 0aa10ab..c650a88 100644 --- a/src/MiniDocs/Markdeep.class.st +++ b/src/MiniDocs/Markdeep.class.st @@ -213,7 +213,9 @@ Markdeep >> markdeepScriptTag [ { #category : #accessing } Markdeep >> markdownFile [ - ^ self file ifNil: [ self file: FileLocator temp / ('untitled--', NanoID generate, '.md')]. + self file ifNil: [ + self file: FileLocator temp / ('untitled--', NanoID generate, '.md.html') ]. + ^ (self file fullName withoutSuffix: '.html') asFileReference. ] { #category : #accessing } @@ -276,10 +278,10 @@ Markdeep >> printOn: aStream [ Markdeep >> processMarkdownFor: aFileReference [ "comment stating purpose of message" | markdownContent | - self markdownFile: aFileReference. + self file: aFileReference, 'html'. markdownContent := Markdown fromFile: aFileReference. + self metadata: markdownContent yamlMetadata. self body: (markdownContent commentYAMLMetadata contents). - self metadata: markdownContent yamlMetadata ] { #category : #accessing } diff --git a/src/MiniDocs/Markdown.class.st b/src/MiniDocs/Markdown.class.st index 5356a96..069619f 100644 --- a/src/MiniDocs/Markdown.class.st +++ b/src/MiniDocs/Markdown.class.st @@ -30,12 +30,12 @@ Markdown >> commentYAMLMetadata [ | newContents | self detectYAMLMetadata ifFalse: [ ^ self ]. newContents := '' writeStream. - newContents nextPutAll: ''; crlf. + newContents nextPutAll: String lf. + newContents nextPutAll: '-->'; lf; lf. (self lines copyFrom: self yamlMetadataClosingLineNumber + 2 to: self lines size) do: [ :line | - newContents nextPutAll: line; crlf ]. + newContents nextPutAll: line; lf;lf ]. ^ newContents contents. ] @@ -64,6 +64,16 @@ Markdown >> contentsWithoutYAMLMetadata [ ^ newContents contents. ] +{ #category : #operation } +Markdown >> deleteYAMLMetadata [ + | newContents | + self detectYAMLMetadata ifFalse: [ ^ self ]. + newContents := '' writeStream. + (self lines copyFrom: self yamlMetadataClosingLineNumber + 1 to: self lines size) do: [ :line | + newContents nextPutAll: line; lf;lf ]. + ^ newContents contents. +] + { #category : #utilities } Markdown >> detectYAMLMetadata [ | lines | @@ -74,6 +84,13 @@ Markdown >> detectYAMLMetadata [ ifFound: [ ^ true ] ifNone: [ ^ false ] ] ] +{ #category : #accessing } +Markdown >> documentTree [ + | parser| + parser := PPCommonMarkBlockParser new parse: self contents. + ^ parser accept: CMBlockVisitor new +] + { #category : #persistence } Markdown >> exportAsFile [ | newFile | @@ -222,7 +239,7 @@ Markdown >> yamlMetadataString [ yamlLines do: [ :line | output nextPutAll: line; - nextPut: Character cr. ]. + nextPut: Character lf. ]. ^ output contents ] diff --git a/src/PetitMarkdown/PPCMEmphasize.class.st b/src/PetitMarkdown/PPCMEmphasize.class.st index 6202915..453d68a 100644 --- a/src/PetitMarkdown/PPCMEmphasize.class.st +++ b/src/PetitMarkdown/PPCMEmphasize.class.st @@ -8,3 +8,25 @@ Class { PPCMEmphasize >> accept: visitor [ ^ visitor visitEmphasize: self ] + +{ #category : #accessing } +PPCMEmphasize >> viewBody [ + | aText | + aText := (self className ,' ', self text) asRopedText. + + self children do: [ :child | + aText append: ' ' asRopedText. + aText append: (child text asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: ('= "' asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: (child text asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: + ('"' asRopedText foreground: + BrGlamorousColors disabledButtonTextColor) + ]. + + + ^ aText +] diff --git a/src/PetitMarkdown/PPCMHardBreak.class.st b/src/PetitMarkdown/PPCMHardBreak.class.st index 6f15b51..cb737bd 100644 --- a/src/PetitMarkdown/PPCMHardBreak.class.st +++ b/src/PetitMarkdown/PPCMHardBreak.class.st @@ -8,3 +8,25 @@ Class { PPCMHardBreak >> accept: visitor [ ^ visitor visitHardBreak: self ] + +{ #category : #accessing } +PPCMHardBreak >> viewBody [ + | aText | + aText := (self className ,' ', self text) asRopedText. + + self children do: [ :child | + aText append: ' ' asRopedText. + aText append: (child text asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: ('= "' asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: (child text asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: + ('"' asRopedText foreground: + BrGlamorousColors disabledButtonTextColor) + ]. + + + ^ aText +] diff --git a/src/PetitMarkdown/PPCMHtmlBlock.class.st b/src/PetitMarkdown/PPCMHtmlBlock.class.st index d939508..eb36dc8 100644 --- a/src/PetitMarkdown/PPCMHtmlBlock.class.st +++ b/src/PetitMarkdown/PPCMHtmlBlock.class.st @@ -13,3 +13,25 @@ PPCMHtmlBlock >> accept: visitor [ PPCMHtmlBlock >> isBlockLevel [ ^ true ] + +{ #category : #accessing } +PPCMHtmlBlock >> viewBody [ + | aText | + aText := (self className ,' ', self text) asRopedText. + + self children do: [ :child | + aText append: ' ' asRopedText. + aText append: (child text asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: ('= "' asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: (child text asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: + ('"' asRopedText foreground: + BrGlamorousColors disabledButtonTextColor) + ]. + + + ^ aText +] diff --git a/src/PetitMarkdown/PPCMIndentedCode.class.st b/src/PetitMarkdown/PPCMIndentedCode.class.st index d2cd398..0b01f5a 100644 --- a/src/PetitMarkdown/PPCMIndentedCode.class.st +++ b/src/PetitMarkdown/PPCMIndentedCode.class.st @@ -18,3 +18,25 @@ PPCMIndentedCode >> code [ PPCMIndentedCode >> isBlockLevel [ ^ true ] + +{ #category : #accessing } +PPCMIndentedCode >> viewBody [ + | aText | + aText := (self className ,' ', self text) asRopedText. + + self children do: [ :child | + aText append: ' ' asRopedText. + aText append: (child text asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: ('= "' asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: (child text asRopedText foreground: + BrGlamorousColors disabledButtonTextColor). + aText append: + ('"' asRopedText foreground: + BrGlamorousColors disabledButtonTextColor) + ]. + + + ^ aText +]