HedgeDoc convert/import as LePage promotes Markdown headers.
This commit is contained in:
parent
60939fe2b8
commit
536d2a9326
@ -31,11 +31,13 @@ HedgeDoc class >> newDefault [
|
|||||||
HedgeDoc >> asLePage [
|
HedgeDoc >> asLePage [
|
||||||
| newPage snippet |
|
| newPage snippet |
|
||||||
snippet := LeTextSnippet new
|
snippet := LeTextSnippet new
|
||||||
string: self bodyWithoutTitleHeader.
|
string: self bodyWithoutTitleHeader promoteMarkdownHeaders.
|
||||||
newPage := LePage new
|
newPage := LePage new
|
||||||
initializeTitle: self title;
|
initializeTitle: self title;
|
||||||
addSnippet: snippet;
|
addSnippet: snippet;
|
||||||
yourself.
|
yourself.
|
||||||
|
newPage incomingLinks.
|
||||||
|
newPage metadata addAll: self metadata.
|
||||||
^ newPage
|
^ newPage
|
||||||
]
|
]
|
||||||
|
|
||||||
|
8
src/MiniDocs/LeHeaderNode.extension.st
Normal file
8
src/MiniDocs/LeHeaderNode.extension.st
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Extension { #name : #LeHeaderNode }
|
||||||
|
|
||||||
|
{ #category : #'*MiniDocs' }
|
||||||
|
LeHeaderNode >> headerFullName [
|
||||||
|
^ self topParent completeSource
|
||||||
|
copyFrom: self startPosition
|
||||||
|
to: self stopPosition
|
||||||
|
]
|
@ -50,6 +50,16 @@ String >> detectYAMLMetadata [
|
|||||||
ifFound: [ ^ true ] ifNone: [ ^ false ] ]
|
ifFound: [ ^ true ] ifNone: [ ^ false ] ]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'*MiniDocs' }
|
||||||
|
String >> promoteMarkdownHeaders [
|
||||||
|
| headers response |
|
||||||
|
response := self contents.
|
||||||
|
headers := (LeTextSnippet string: response) ast // #LeHeaderNode collect: [ :each | each headerFullName asString ].
|
||||||
|
headers do: [ :each |
|
||||||
|
response := response copyReplaceAll: each with: each allButFirst ].
|
||||||
|
^ response
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
String >> romanizeAccents [
|
String >> romanizeAccents [
|
||||||
| modified corrections |
|
| modified corrections |
|
||||||
|
Loading…
Reference in New Issue
Block a user