Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hughess/markdoc",
"name": "@archiewood/markdoc",
"author": "Ryan Paul",
"version": "0.0.0-evidence.28",
"version": "0.0.0-evidence.29",
"description": "A text markup language for documentation",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
138 changes: 138 additions & 0 deletions spec/marktest/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2302,3 +2302,141 @@
children:
- tag: p
children: [This is a test]

- name: Triple-quoted string attribute
config:
tags:
test:
render: test
attributes:
bar:
type: String
render: true
code: |
{% test bar="""simple string""" /%}
expected:
- tag: test
attributes:
bar: 'simple string'

- name: Triple-quoted string with quotes inside
config:
tags:
test:
render: test
attributes:
bar:
type: String
render: true
code: |
{% test bar="""He said "hello" and 'goodbye'""" /%}
expected:
- tag: test
attributes:
bar: 'He said "hello" and ''goodbye'''

- name: Triple-quoted string with newlines
config:
tags:
test:
render: test
attributes:
query:
type: String
render: true
code: |
{% test query="""
SELECT *
FROM users
WHERE active = true
""" /%}
expected:
- tag: test
attributes:
query: "\nSELECT *\nFROM users\nWHERE active = true\n"

- name: Triple-quoted string with SQL CASE statement
config:
tags:
table:
render: table
attributes:
series:
type: String
render: true
code: |
{% table series="""
case
when total_sales > 18000 then 'High'
when total_sales > 9000 then 'Medium'
else 'Low'
end
""" /%}
expected:
- tag: table
attributes:
series: "\n case\n when total_sales > 18000 then 'High'\n when total_sales > 9000 then 'Medium'\n else 'Low'\n end\n"

- name: Mixed regular and triple-quoted strings
config:
tags:
test:
render: test
attributes:
foo:
type: String
render: true
bar:
type: String
render: true
baz:
type: Boolean
render: true
code: |
{% test foo="regular" bar="""triple
quoted""" baz=true /%}
expected:
- tag: test
attributes:
foo: 'regular'
bar: "triple\nquoted"
baz: true

- name: Empty triple-quoted string
config:
tags:
test:
render: test
attributes:
bar:
type: String
render: true
code: |
{% test bar="""""" /%}
expected:
- tag: test
attributes:
bar: ''

- name: Triple-quoted string with interpolation
config:
variables:
condition: "status = 'active'"
tags:
test:
render: test
attributes:
query:
type: String
render: true
code: |
{% test query="""
SELECT *
FROM users
WHERE {{$condition}}
""" /%}
expected:
- tag: test
attributes:
query: "\nSELECT *\nFROM users\nWHERE status = 'active'\n"

Loading