Text snippet

A text snippet, like this very one, supports an extensible Markdown.

Basic Markdown

Headers:

Header 1

Header 2

Header 3

Formatted text:

italic

bold

fixed size

        
Multi-line 
fixed size text
        
      

Link:

Extensions

Lepiter is extensible. One extension mechanism is that of annotations.

Class reference:

LeParser SmaCCGLRParser subclass: #LeParser instanceVariableNames: '' classVariableNames: 'AnnotationParsers' package: 'Lepiter-Parser'

Method reference:

LePage>>#title title "Answer the page's title" <return: #String> ^ type title

Example reference:

LeTextSnippetExamples>>#textSnippetWithLinkToPage
	<gtExample>
	| aPage aSnippet |

	aSnippet := LeTextSnippet string: (String loremIpsum: 100) allButLast, ' [[two]] ', (String loremIpsum: 100).

	aPage := self database pageBuilder title: 'one'; add.
	aPage addSnippet: aSnippet.

	self assert: aSnippet class equals: LeTextSnippet.

	^ aSnippet
        

Page reference:

Parsing

The basic parser is LeParser SmaCCGLRParser subclass: #LeParser instanceVariableNames: '' classVariableNames: 'AnnotationParsers' package: 'Lepiter-Parser' :

LeParser parse: '#Header
##Header 2
###Header 3
###Header 4
`fixed size`
*italic*
**bold**
'
  

The annotation parser is LeAnnotationParser SmaCCGLRParser subclass: #LeAnnotationParser instanceVariableNames: '' classVariableNames: '' package: 'Lepiter-Parser' , but it is composable with the basic parser. For example, explore the result of the code below and notice how there is a single abstract syntax tree that can be browsed uniformly:

LeParser parse: 'This is regular Markdown. But, this is annotation: {{gtExample:LeTextSnippetExamples>>textSnippetWithLinkToPage | noCode= false | previewHeight= 200 | previewExpanded= true}}'