Skip to content

Instantly share code, notes, and snippets.

@AMiller42
Created December 16, 2021 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AMiller42/f0d1196a631f27055ce1133d5a34327c to your computer and use it in GitHub Desktop.
Save AMiller42/f0d1196a631f27055ce1133d5a34327c to your computer and use it in GitHub Desktop.
tentative pre0.0.0 spec for Descend

Descend Markdown:

Headings:

#, ##, ###, etc.
#, #2, #3, etc.

Paragraphs:

A single newline will start a new paragraph, backslash before newline does <br>.
\n, ⁋

Line Break:

'  ', \\n

Formatting:

*bold*
_italics_
~strikethrough~
=highlighting=
^superscript^
!subscript!

*_~bold italic strikethrough~_*
=^_highlighted superscript italics_^=
etc.

Blockquotes:

>/<
Blockquotes a single paragraph, unless there is a matching < to delimit it

Ordered Lists:

.

Unordered Lists:

*, +/-

Links:

[Link Text](link/url)
![Img Caption](image/url)

[Link Text][Link Ref]
[Link Ref]: link/url

<link url>

Code:

` `, `` ``

Code Blocks:

``` ```, `\n `, ``\n ``

Horizontal Rule:

---

Tables:

    |x|y|z|     |f|     | x | y | z |
    |-|-|-|     |g|     |:- |:-:| -:|
    |a|b|c|     |h|     | a | b | c |
    |d|e|f|     |i|     | d | e | f |
    
    x|y|z       f|      x|y|z           a|b|c
    -           g|      <|-|>           d|e|f
    a|b|c       h|      a|b|c           g|h|i
    d|e|f       i|      d|e|f           j|k|l

Footnotes:

[^name], [1], [^]

Definition Lists:

Key         Key
:Value      :Value1
            :Value2
            :etc

Task Lists:

-[] False
-[x] True

Emoji Shortcodes:

:joy: :emoji_name: :x:

Textareas:

(Optional Text)

IDs:

#Heading @id

(Textarea) @id

Key @id
:Value

``` @id
code block
```

x|y|z @id
-
a|b|c
d|e|f

TODO: Define Raw HTML

Descend Scripting:

Script:

{ script }

Dynamic Typing

Data Types from Descend Markdown:

Arrays:
  a|b
  c|d
  e|f

Booleans:
  -[] False
  -[x] True

Dicts:
  Key
  :Value

Reserved words:

case
catch
continue
del
do
edit
else
eval
false
for
func
if
in
keep
new
null
print
return
start
switch
then
this
throw
true
try
type
unkeep
while
with
yield

Scripting Examples:

Create New Headers With Loop:

Descend:
    { for x in 10 { new("#", "Header${x}", "H{x}") } }

Output:
    #Header1 @H1
    #Header2 @H2
    #Header3 @H3
    #Header4 @H4
    #Header5 @H5
    #Header6 @H6
    #Header7 @H7
    #Header8 @H8
    #Header9 @H9
    #Header10 @H10

Delete All <h2> Headers:

Descend:
    # H1
    #2 H2
    #3 H3
    ## H2
    #### H4
    ##### H5
    ## H2
    { for x in this { if type(x) == "##" { del(x) } } }
    
Output:
    # H1
    #3 H3
    #### H4
    ##### H5

Create a New Script:

Descend:
    { new("{}", 'print("Hello, World!")') }
    
Output:
    { print("Hello, World!") }

Delete All Content On The Page:

    Descend:
        { del(this) }
        
    Output:

Get Variables From Descend:

Descend:
    # Header @x
    
    (Text) @y
    
    a|b|c
    -
    d|e|f
    g|h|i
    
    n| @z
    m|
    o|
    
    { var_1 = @x
      var_2 = @y
      var_3 = @z
      arr_1 = @_abc
      del(this)
      print( var_1 )
      print( var_3[1] )
      print( var_2 )
      print( arr_1[0] )
      print( arr_1["c"] )
      new( "##", arr_1["c"][1] ) }
      
Output:
    Header
    m
    Text
    d|
    g|
    
    f|
    i|
    
    ## f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment