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 [
|
||||
| newPage snippet |
|
||||
snippet := LeTextSnippet new
|
||||
string: self bodyWithoutTitleHeader.
|
||||
string: self bodyWithoutTitleHeader promoteMarkdownHeaders.
|
||||
newPage := LePage new
|
||||
initializeTitle: self title;
|
||||
addSnippet: snippet;
|
||||
yourself.
|
||||
newPage incomingLinks.
|
||||
newPage metadata addAll: self metadata.
|
||||
^ 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 ] ]
|
||||
]
|
||||
|
||||
{ #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' }
|
||||
String >> romanizeAccents [
|
||||
| modified corrections |
|
||||
|
Loading…
Reference in New Issue
Block a user