htmlToMarkdown functionality.
This commit is contained in:
parent
01f6e38520
commit
432f8bd64f
@ -502,6 +502,18 @@ GrafoscopioNode >> headers [
|
||||
^ headers := self children collect: [:currentNode | currentNode header ]
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
GrafoscopioNode >> htmlToMarkdown [
|
||||
"I convert the node body from HTML format to Pandoc's Markdown."
|
||||
| htmlFile |
|
||||
htmlFile := FileLocator temp asFileReference / 'body.html'.
|
||||
htmlFile ensureDelete.
|
||||
htmlFile ensureCreateFile.
|
||||
htmlFile writeStreamDo: [:stream | stream nextPutAll: self body].
|
||||
self body: (PipeableOSProcess command: 'pandoc -f html -t markdown --atx-headers ', htmlFile fullName) output.
|
||||
"htmlFile ensureDelete."
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
GrafoscopioNode >> icon [
|
||||
"Returns the receivers icon"
|
||||
|
@ -261,6 +261,16 @@ GrafoscopioNotebook >> header: anObject [
|
||||
header := anObject
|
||||
]
|
||||
|
||||
{ #category : #operation }
|
||||
GrafoscopioNotebook >> htmlToMarkdown [
|
||||
| currentNode nodeContent |
|
||||
currentNode := tree highlightedItem.
|
||||
currentNode ifNil: [ ^ self ].
|
||||
nodeContent := currentNode content.
|
||||
nodeContent htmlToMarkdown.
|
||||
self updateBodyFor: currentNode
|
||||
]
|
||||
|
||||
{ #category : #operation }
|
||||
GrafoscopioNotebook >> importLinkContent [
|
||||
"I see if a node header is an url located at 'http://ws.stfx.eu', wich means that is a shared
|
||||
@ -819,6 +829,13 @@ GrafoscopioNotebook >> topBar [
|
||||
description: 'Import link content';
|
||||
icon: #glamorousRefresh asIcon;
|
||||
action: [ self importLinkContent ] ].
|
||||
group
|
||||
addItem: [ :item |
|
||||
item
|
||||
name: nil;
|
||||
description: 'HTML to Markdown';
|
||||
icon: #smallProfile asIcon;
|
||||
action: [ self htmlToMarkdown ] ].
|
||||
group
|
||||
addItem: [ :item |
|
||||
item
|
||||
|
Loading…
Reference in New Issue
Block a user