Fixing Markdown importation for simple cases.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-11-04 06:33:55 -05:00
parent babbd48934
commit d470dd533c
2 changed files with 24 additions and 11 deletions

View File

@ -33,13 +33,24 @@ HedgeDoc >> asLePage [
sanitizedMarkdown := self bodyWithoutTitleHeader promoteMarkdownHeaders.
newPage := LePage new
initializeTitle: self title.
sanitizedMarkdown markdownSplitted do: [:lines | | snippet |
sanitizedMarkdown := sanitizedMarkdown markdownSplitted.
sanitizedMarkdown class = OrderedCollection ifTrue: [
sanitizedMarkdown do: [:lines | | snippet |
snippet := LeTextSnippet new
string: lines asStringWithCr;
uid: LeUID new.
newPage
addSnippet: snippet;
yourself
]
].
sanitizedMarkdown class = ByteString ifTrue: [ | snippet |
snippet := LeTextSnippet new
string: sanitizedMarkdown;
uid: LeUID new.
newPage
addSnippet: snippet;
yourself
].
newPage incomingLinks.
newPage splitAdmonitionSnippets.
@ -159,7 +170,7 @@ HedgeDoc >> server: aUrlString [
{ #category : #accessing }
HedgeDoc >> url [
^ url asUrl
url ifNotNil: [ ^ url asUrl ]
]
{ #category : #accessing }

View File

@ -293,8 +293,10 @@ LePage >> sharedVariablesBindings [
{ #category : #'*MiniDocs' }
LePage >> splitAdmonitionSnippets [
"I'm used to clean after importing from HedgeDoc to ensure that a snippet contains only admonitions and extra content is put in a new cell."
(self children select: [:node | node string startsWithMarkdownAdmonition ])
do: [:node | | nodeContent |
| admonitionSnippets |
admonitionSnippets := self children select: [:node | node string startsWithMarkdownAdmonition ].
admonitionSnippets ifEmpty: [ ^ self ].
admonitionSnippets do: [:node | | nodeContent |
node ifNotNil: [
nodeContent := node string.
nodeContent startsWithMarkdownAdmonition