Improving Markdeep files reading and Markdown document tree views.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-03-04 11:15:44 -05:00
parent 004b286835
commit 4199ed0a6c
2 changed files with 17 additions and 3 deletions

View File

@ -166,13 +166,22 @@ Markdeep >> file: aFileReference [
{ #category : #accessing }
Markdeep >> fillInContentsFrom: aFileReference [
| docTree headTree |
| docTree docTreeChildren headTree tempTitle bodyLineIndex |
docTree := (Markdown new contents: aFileReference contents) documentTree.
headTree := (docTree children
docTreeChildren := docTree children.
headTree := (docTreeChildren
detect: [ :node |
node className = 'PPCMParagraph'
and: [ (node children detect: [ :subnode | subnode text = '<head>' ]) isNotNil ] ]).
^ headTree
headTree children allButFirst allButLast do: [:node |
(node className = 'PPCMHtml') ifTrue: [ self head add: node text ]
].
self head: self head asSet asOrderedCollection.
tempTitle := ((docTreeChildren detect: [ :node | node className = 'PPCMIndentedCode'])
children detect: [:subnode | subnode text trimmed beginsWith: '**']) text trimmed.
bodyLineIndex := docTreeChildren detectIndex: [ :node | node text includesSubstring: tempTitle ].
self title: (tempTitle copyFrom: 3 to: tempTitle size - 2).
^ { self head . self title . bodyLineIndex . docTree }
]
{ #category : #accessing }

View File

@ -23,3 +23,8 @@ PPCMBlockQuote >> initialize [
PPCMBlockQuote >> isBlockLevel [
^ true
]
{ #category : #accessing }
PPCMBlockQuote >> viewBody [
^ (self className ,' ', self text) asRopedText.
]