From 1dff640de8817eb16b32c9d4d1d1121924e149c1 Mon Sep 17 00:00:00 2001 From: chihiro sakai Date: Sat, 19 Feb 2022 04:31:10 +0900 Subject: [PATCH] update README --- README.limp | 101 ++++++++++++++++++++++++++++++++++++++++++++-- docs/index.limp | 105 +++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 196 insertions(+), 10 deletions(-) diff --git a/README.limp b/README.limp index f7ee209..44358aa 100644 --- a/README.limp +++ b/README.limp @@ -120,6 +120,36 @@ The above example are shown like this\: This is another example of list item. +:label(unparsed-marker):Unparsed Marker; +**************************************** + +A role or role block can have an :b:unparsed marker;. +You can use this marker to mark a text segment, force the parser not to parse and treat the containing text as plain text. +This functionality shall be helpful with code roles or implementing custom embedded metadata roles. + +Example\: + +::*code~ + + ::*comment~ + code role with unparsed marker: + + ::*code~ + :u:This is a :i:example; of :b:code; block.; + + ::*comment~ + code role without unparsed marker: + + ::code~ + :u:This is a :i:example; of :b:code; block.; + +Output\: + +::*code~ + :u:This is a :i:example; of :b:code; block.; + +::code~ + :u:This is a :i:example; of :b:code; block.; :label(default-roles):Default Roles; ------------------------------------ @@ -131,16 +161,22 @@ Limp has a default set of some roles\: :ref(#image):Image; ::item~ - :ref(#line-break):Line Break; + :ref(#block-code):Block Code; ::item~ - :ref(#block-code):Block Code; + :ref(#list):List; + + ::item~ + :ref(#table):Table; + + ::item~ + :ref(#comments):Comments; ::item~ - :ref(#block-list):Block List; + :ref(#block-quote):Block Quote; ::item~ - :ref(#block-table):Block Table; + :ref(#details-spoiler):Details/Spoiler; Here is a complete table of inline roles and their appearance\: @@ -157,3 +193,60 @@ Here is a complete table of inline roles and their appearance\: :td::*code:strike;; :td::s:text;; :td::*code:s;; :td:; ::tr~ :td::*code:code;; :td::*code:text;; :td:; :td:code role can also be used as a block role.; + ::tr~ + :td::*code:label;; :td::label(#test-label)::text;; :td:; + :td:label role can also be used as a block role. It is used to mark a significant point in the document to refer from somewhere.; + ::tr~ + :td::*code:ref;; :td::ref(#test-label)::text;; :td:; :td:code role can also be used as a block role.; + ::tr~ + :td::*code:br;; :td:; :td:; :td:this role inserts a line break; + +:label(image):Image; +******************** + +:*code:img; role is a way to embed an image in the document. This role has 3 attributes\: + +::table~ + ::th~ + :td:Attribute Name; :td:Description; :td:Required?; + ::tr~ + :td::*code:src;; :td:The URL of the image.; :td:Yes; + ::tr~ + :td::*code:alt;; :td:The alternative text of the image.; :td:No; + ::tr~ + :td::*code:title;; :td:The title of the image.; :td:No; + +Example\: + +::*code~ + :img(image_url)::; + + :img(image_url, "alternative text")::; + + :img(image_url, "alternative text")::; + + :img(image_url, alt="alternative text", title="tooltip text")::; + +:label(block-code):Block Code; +****************************** +:*code:code; role is a way to embed a code block in the document. +You should use this role with :*code:*; unparsed marker. + +Example\: + +::*code~ + ::*code~ + # This is a Python code + + import sys + + print([line.split(','): for line in sys.stdin]) + +Output\: + +::*code~ + # This is a Python code + + import sys + + print([line.split(','): for line in sys.stdin]) diff --git a/docs/index.limp b/docs/index.limp index edff5ca..e01fc72 100644 --- a/docs/index.limp +++ b/docs/index.limp @@ -87,7 +87,7 @@ Note you can make custom renderers and use them in your project to process your ******************************** :bold:Block role; is another way to mark a text with a role. -In contrast to inline roles, block roles mark up a chunk of texts.:br:; +In contrast to inline roles, block roles mark up a chunk of texts. For example\: @@ -108,7 +108,7 @@ For example\: This is another example of list item. Blocks are indicated by an indentation consisting of some spaces (code point :*code:0x20;). Note tab characters are not counted and ignored when the limp parser measures the indentation level of a line. -When some "dedents" appear and the indentation level turned to the same or less level as the start of the block, it is the end of the block.:br:; +When some "dedents" appear and the indentation level turned to the same or less level as the start of the block, it is the end of the block. The above example are shown like this\: @@ -126,6 +126,36 @@ The above example are shown like this\: This is another example of list item. +:label(unparsed-marker):Unparsed Marker; +**************************************** + +A role or role block can have an :b:unparsed marker;. +You can use this marker to mark a text segment, force the parser not to parse and treat the containing text as plain text. +This functionality shall be helpful with code roles or implementing custom embedded metadata roles. + +Example\: + +::*code~ + + ::*comment~ + code role with unparsed marker: + + ::*code~ + :u:This is a :i:example; of :b:code; block.; + + ::*comment~ + code role without unparsed marker: + + ::code~ + :u:This is a :i:example; of :b:code; block.; + +Output\: + +::*code~ + :u:This is a :i:example; of :b:code; block.; + +::code~ + :u:This is a :i:example; of :b:code; block.; :label(default-roles):Default Roles; ------------------------------------ @@ -137,16 +167,22 @@ Limp has a default set of some roles\: :ref(#image):Image; ::item~ - :ref(#line-break):Line Break; + :ref(#block-code):Block Code; ::item~ - :ref(#block-code):Block Code; + :ref(#list):List; + + ::item~ + :ref(#table):Table; + + ::item~ + :ref(#comments):Comments; ::item~ - :ref(#block-list):Block List; + :ref(#block-quote):Block Quote; ::item~ - :ref(#block-table):Block Table; + :ref(#details-spoiler):Details/Spoiler; Here is a complete table of inline roles and their appearance\: @@ -163,3 +199,60 @@ Here is a complete table of inline roles and their appearance\: :td::*code:strike;; :td::s:text;; :td::*code:s;; :td:; ::tr~ :td::*code:code;; :td::*code:text;; :td:; :td:code role can also be used as a block role.; + ::tr~ + :td::*code:label;; :td::label(#test-label)::text;; :td:; + :td:label role can also be used as a block role. It is used to mark a significant point in the document to refer from somewhere.; + ::tr~ + :td::*code:ref;; :td::ref(#test-label)::text;; :td:; :td:code role can also be used as a block role.; + ::tr~ + :td::*code:br;; :td:; :td:; :td:this role inserts a line break; + +:label(image):Image; +******************** + +:*code:img; role is a way to embed an image in the document. This role has 3 attributes\: + +::table~ + ::th~ + :td:Attribute Name; :td:Description; :td:Required?; + ::tr~ + :td::*code:src;; :td:The URL of the image.; :td:Yes; + ::tr~ + :td::*code:alt;; :td:The alternative text of the image.; :td:No; + ::tr~ + :td::*code:title;; :td:The title of the image.; :td:No; + +Example\: + +::*code~ + :img(image_url)::; + + :img(image_url, "alternative text")::; + + :img(image_url, "alternative text")::; + + :img(image_url, alt="alternative text", title="tooltip text")::; + +:label(block-code):Block Code; +****************************** +:*code:code; role is a way to embed a code block in the document. +You should use this role with :*code:*; unparsed marker. + +Example\: + +::*code~ + ::*code~ + # This is a Python code + + import sys + + print([line.split(','): for line in sys.stdin]) + +Output\: + +::*code~ + # This is a Python code + + import sys + + print([line.split(','): for line in sys.stdin])