accordproject / markdown-transform Goto Github PK
View Code? Open in Web Editor NEWParse and transform markdown text, including TemplateMark markdown templates
License: Apache License 2.0
Parse and transform markdown text, including TemplateMark markdown templates
License: Apache License 2.0
README
captures the overall structure of the monorepoREADME
is consistent with other AP reposClause
, Variable
, and ComputedVariable
as Child
nodesThis issue can provide for multiple pull requests.
It would be useful to be able to import contracts from existing PDFs.
https://github.com/jzillmann/pdf-to-markdown
https://pandoc.org
This should be integrated with #145
We should provide protections for the transform to handle more robust markdown transforms.
For instance, putting cicero-ui
's README.md
file through the transform fails at this point.
Describe the bug
When variables are generated the value includes an extra quote (escaped as %22).
<variable id="shipper" value="%22Party%20A%22"/>
Simplify the API, improving naming consistency, update README files to explain the internal architecture.
The values of variables are URI encoded in the Slate DOM.
Describe the bug
typo in the readme file
To Reproduce
Steps to reproduce the behavior:
Fix typo in the readme file
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
Markdown Transform use an uncommon idiom of packaging a dependency (composer-concerto
and composer-concerto-tools
) to avoid problems with multiple versions of the concerto package.
This can be removed whenever the corresponding issues has been resolved: accordproject/concerto#47 and
Describe the bug
HTML inlines do not roundtrip in Slate transform.
To Reproduce
bash-3.2$ cat inline.md
On <code/>
bash-3.2$ ../markdown-cli/index.js normalize --sample inline.md --cicero
9:33:31 AM - info:
On <code/>
bash-3.2$ ../markdown-cli/index.js normalize --sample inline.md --slate
9:33:35 AM - info:
On
undefined
v0.20
project
Is your feature request related to a problem? Please describe.
Need a way to go from a template grammar
or sample
to a Slate DOM with wrapVariables: true
Describe the solution you'd like
This will allow for rendering a formatted clause template without necessarily having the clauseTemplate
Describe the bug
Error occurs when translating markdown to Slate
Additional context
This is happening when taking markdown from a database, which includes an unordered list (ulist
) with a final bullet point which is empty.
The error
Uncaught Error: Node Item doesn't have any children!
at ToSlateVisitor.processChildNodes (VM84894 ToSlateVisitor.js:1809)
at ToSlateVisitor.visit (VM84894 ToSlateVisitor.js:2091)
at ValidatedConcept.accept (VM84924 typed.js:57)
at eval (VM84894 ToSlateVisitor.js:1820)
at Array.forEach (<anonymous>)
at ToSlateVisitor.processChildNodes (VM84894 ToSlateVisitor.js:1815)
at ToSlateVisitor.visit (VM84894 ToSlateVisitor.js:2079)
at ValidatedConcept.accept (VM84924 typed.js:57)
at eval (VM84894 ToSlateVisitor.js:1820)
at Array.forEach (<anonymous>)
From this source code
processChildNodes(thing) {
cov_2olvdi9vnx.f[4]++;
const result = (cov_2olvdi9vnx.s[23]++, []);
cov_2olvdi9vnx.s[24]++;
if (!thing.nodes) {
cov_2olvdi9vnx.b[7][0]++;
cov_2olvdi9vnx.s[25]++;
throw new Error("Node ".concat(thing.getType(), " doesn't have any children!"));
} else {
cov_2olvdi9vnx.b[7][1]++;
}
When using this markdown
This is the contract editor. You can edit this text!
This is a heading!
====
This is [text](http://clause.io "").
Fragile Goods
----
`\`\`\ <clause src="ap://[email protected]#..." clauseid="49c95009-..."/>
Liquidated Damages for Delayed Delivery.
In the event the EXW delivery date of the Equipment is delayed beyond the delivery schedule as indicated below, solely through the fault of <variable id="seller" value="%22Dan%22"/> (the Seller), and unless the parties mutually agreed to an extension thereto, <variable id="buyer" value="%22Steve%22"/> (the Buyer) is entitled to claim liquidated damages in an amount equivalent to <variable id="lateDeliveryPenalty" value="300%20USD"/>.
Prior to implementing the provisions of Article 16.4 pursuant to this section, Buyer agrees that it shall discuss with Seller alternate remedies in good faith.. . . .
The Equipment to be shipped to the Buyer shall be packed and shipped in accordance with the Specifications and if not specified therein....
Additionally the Equipment should have proper devices on it to record any shock during transportation as any instance of acceleration outside the bounds of <variable id="accelerationMin" value="-0.5"/>g and <variable id="accelerationMax" value="0.5"/>g.
Each shock shall reduce the Contract Price by <variable id="accelerationBreachPenalty" value="5%20USD"/>. Packing containing fragile materials should be so marked in bold stout letters. . . . .
Equipment Description, Contract Price and Delivery Schedule
Contract Price is <variable id="deliveryPrice" value="1000%20USD"/> per unit of Equipment.
Delivery Schedule: no later than <variable id="deliveryLimitDuration" value="10%20seconds"/> after initiation.
`\`\`\
- one
- two
- thre
-
Acceptance of Delivery
----
`\`\`\ <clause src="ap://[email protected]#..." clauseid="eb77e820-..."/>
Acceptance of Delivery. <variable id="shipper" value="%22Dan%20Selman%22"/> will be deemed to have completed its delivery obligations if in <variable id="receiver" value="%22Adrian%20Fletcher%22"/>'s opinion, the <variable id="deliverable" value="%22Widgets%22"/> satisfies the Acceptance Criteria, and <variable id="receiver" value="%22Adrian%20Fletcher%22"/> notifies <variable id="shipper" value="%22Dan%20Selman%22"/> in writing that it is accepting the <variable id="deliverable" value="%22Widgets%22"/>.
Inspection and Notice. <variable id="receiver" value="%22Adrian%20Fletcher%22"/> will have <variable id="businessDays" value="10"/> Business Days' to inspect and evaluate the <variable id="deliverable" value="%22Widgets%22"/> on the delivery date before notifying <variable id="shipper" value="%22Dan%20Selman%22"/> that it is either accepting or rejecting the <variable id="deliverable" value="%22Widgets%22"/>.
Acceptance Criteria. The "Acceptance Criteria" are the specifications the <variable id="deliverable" value="%22Widgets%22"/> must meet for the <variable id="shipper" value="%22Dan%20Selman%22"/> to comply with its requirements and obligations under this agreement, detailed in <variable id="attachment" value="%22Attachment%20X%22"/>, attached to this agreement.
`\`\`\
Describe the bug
The Slate transform turns thematic seems to turn thematic breaks into empty paragraphs.
To Reproduce
Here is a simple test.md
:
This is a heading
----
This is a thematic break:
----
This is more paragraph
The Cicero DOM looks fine:
bash-3.2$ markus parse --sample test.md --cicero
10:38:13 - info:
{
"$class": "org.accordproject.commonmark.Document",
"xmlns": "http://commonmark.org/xml/1.0",
"nodes": [
{
"$class": "org.accordproject.commonmark.Heading",
"level": "2",
"nodes": [
{
"$class": "org.accordproject.commonmark.Text",
"text": "This is a heading"
}
]
},
{
"$class": "org.accordproject.commonmark.Paragraph",
"nodes": [
{
"$class": "org.accordproject.commonmark.Text",
"text": "This is a thematic break:"
}
]
},
{
"$class": "org.accordproject.commonmark.ThematicBreak"
},
{
"$class": "org.accordproject.commonmark.Paragraph",
"nodes": [
{
"$class": "org.accordproject.commonmark.Text",
"text": "This is more paragraph"
}
]
}
]
}
But in the Slate DOM the thematic break has disappeared:
bash-3.2$ markus parse --sample test.md --slate
10:38:37 - info:
{
"object": "value",
"document": {
"object": "document",
"data": {
},
"nodes": [
{
"object": "block",
"type": "heading_two",
"data": {
},
"nodes": [
{
"object": "text",
"text": "This is a heading",
"marks": []
}
]
},
{
"object": "block",
"type": "paragraph",
"data": {
},
"nodes": [
{
"object": "text",
"text": "This is a thematic break:",
"marks": []
}
]
},
{
"object": "block",
"type": "paragraph",
"data": {
},
"nodes": []
},
{
"object": "block",
"type": "paragraph",
"data": {
},
"nodes": [
{
"object": "text",
"text": "This is more paragraph",
"marks": []
}
]
}
]
}
}
CTO models for CommonMark DOM and CiceroMark DOM are copied in the code here:
https://github.com/accordproject/markdown-transform/blob/master/packages/markdown-common/src/Models.js
and here:
https://github.com/accordproject/markdown-transform/blob/master/packages/markdown-cicero/src/Models.js
Those should be consistent with the officially published version at https://models.accordproject.org
Instead of copying those in the code (which is error prone and does not guarantee consistency when the published version changes), we should download them from the https://models.accordproject.org as part of the build process.
This could be done through the new concerto command line (see accordproject/concerto#67)
Describe the bug
Uncaught TypeError: Cannot read property 'replace' of undefined at Function.escapeCodeBlock at ToMarkdownStringVisitor.visit
error can be caused when certain documents use the transform
Describe the bug
Installing the Command Line Interface works:
bash-3.2$ npm -g install @accordproject/markdown-cli
+ @accordproject/[email protected]
updated 1 package in 10.988s
But trying to run it, you get:
bash-3.2$ mdtransform --help
module.js:550
throw err;
^
Error: Cannot find module 'jsome'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/jeromesimeon/.nvm/versions/node/v8.12.0/lib/node_modules/@accordproject/markdown-cli/node_modules/@accordproject/markdown-common/lib/Logger.js:1214:39)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
Most likely some dependencies are missing from the package.json
in markdown-cli
.
Item
should always be included in List
, so the following case should be turned into an error:
For instance:
bash-3.2$ cd packages/markdown-cli
bash-3.2$ ./index.js parse --sample test/data/acceptance.md --withSlate --generateMarkdown
13:27:39 - info:
HELLO! This is the contract editor.
====
And below is a **clause**.
```
undefined```
Cicero draft
will be changed to put all conditional variables in markdown XML
This package should handle this change and put variables in the Slate object, maybe in the data of the inline?
For commonMark
to ciceroMark
and ciceroMark
to Slate:
Adjust to handling these inlines being changed
Related issue comment by Jerome:
Late Delivery and Penalty.
----
In case of delayed delivery<if id="forceMajeure" whenTrue=" except for Force Majeure cases," whenFalse=" even when there is a Force Majeure," value="true"/>
<variable id="seller" value="%22Dan%22"/> (the Seller) shall pay to <variable id="buyer" value="%22Steve%22"/> (the Buyer) for every <variable id="penaltyDuration" value="2%20days"/>
of delay penalty amounting to <variable id="penaltyPercentage" value="10.5"/>% of the total value of the Equipment
whose delivery has been delayed. Any fractional part of a <variable id="fractionalPart" value="days"/> is to be
considered a full <variable id="fractionalPart" value="days"/>. The total amount of penalty shall not however,
exceed <variable id="capPercentage" value="55.0"/>% of the total value of the Equipment involved in late delivery.
If the delay is more than <variable id="termination" value="15%20days"/>, the Buyer is entitled to terminate this Contract.
{
"object": "inline",
"type": "conditional",
"data": {
"id": "forceMajeure",
"whenTrue": " except for Force Majeure cases,",
"whenFalse": " even when there is a Force Majeure,",
"value": false
},
"nodes": [
{
"object": "text",
"text": " even when there is a Force Majeure,",
"marks": []
}
]
},
The latest 0.7.0
does not install due to the structure of the build with the new external model scripts.
bash-3.2$ npm install -g @accordproject/[email protected]
/Users/jeromesimeon/.nvm/versions/node/v8.12.0/bin/markus -> /Users/jeromesimeon/.nvm/versions/node/v8.12.0/lib/node_modules/@accordproject/markdown-cli/index.js
> @accordproject/[email protected] postinstall /Users/jeromesimeon/.nvm/versions/node/v8.12.0/lib/node_modules/@accordproject/markdown-cli/node_modules/@accordproject/markdown-common
> node ./scripts/getExternalModels.js
module.js:550
throw err;
^
Error: Cannot find module '/Users/jeromesimeon/.nvm/versions/node/v8.12.0/lib/node_modules/@accordproject/markdown-cli/node_modules/@accordproject/markdown-common/scripts/getExternalModels.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @accordproject/[email protected] postinstall: `node ./scripts/getExternalModels.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @accordproject/[email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jeromesimeon/.npm/_logs/2019-10-26T18_52_10_502Z-debug.log
Hacktoberfest-
add image for clone or fork
or view here
Describe the bug
Some nodes disappear in the Slate to CiceroMark transform.
To Reproduce
Steps to reproduce the behavior:
acceptance.txt
file (which contains JSON)markus draft --slate --data acceptance.txt
Acceptance of Delivery.
----
Inspection and Notice.
----
Acceptance Criteria.
----
The "Acceptance Criteria" are the specifications the <variable id="deliverable" value="%22Widgets%22"/>
must meet for the <variable id="shipper" value="%22Party%20A%22"/> to comply with its requirements and
obligations under this agreement, detailed in <variable id="attachment" value="%22Attachment%20X%22"/>, attached
to this agreement.
Instead of the expected:
Acceptance of Delivery.
----
<variable id="shipper" value="%22Partry%20eeA%22"/> will be deemed to have completed its delivery obligations
if in <variable id="receiver" value="%22Party%20B%22"/>'s opinion, the <variable id="deliverable" value="%22Widgets%22"/> satisfies the
Acceptance Criteria, and <variable id="receiver" value="%22Party%20B%22"/> notifies <variable id="shipper" value="%22Party%20A%22"/> in writing
that it is accepting the <variable id="deliverable" value="%22Widgets%22"/>.
Inspection and Notice.
----
<variable id="receiver" value="%22Party%20B%22"/> will have <variable id="businessDays" value="10"/> Business Days to inspect and
evaluate the <variable id="deliverable" value="%22Widgets%22"/> on the delivery date before notifying
<variable id="shipper" value="%22Party%20A%22"/> that it is either accepting or rejecting the
<variable id="deliverable" value="%22Widgets%22"/>.
Acceptance Criteria.
----
The "Acceptance Criteria" are the specifications the <variable id="deliverable" value="%22Widgets%22"/>
must meet for the <variable id="shipper" value="%22Party%20A%22"/> to comply with its requirements and
obligations under this agreement, detailed in <variable id="attachment" value="%22Attachment%20X%22"/>, attached
to this agreement.
There is no reason why arbitrary HTML inline attributes should be decoded, this is an assumption made only for CiceroMark wrapped variables:
bash-3.2$ cat test/data/inline.md
This is a <custom src="property%20or%20something"/> property.
bash-3.2$ ../markdown-cli/index.js parse --sample test/data/inline.md
12:12:12 - info:
{
"$class": "org.accordproject.commonmark.Document",
"xmlns": "http://commonmark.org/xml/1.0",
"nodes": [
{
"$class": "org.accordproject.commonmark.Paragraph",
"nodes": [
{
"$class": "org.accordproject.commonmark.Text",
"text": "This is a "
},
{
"$class": "org.accordproject.commonmark.HtmlInline",
"tag": {
"$class": "org.accordproject.commonmark.TagInfo",
"tagName": "custom",
"attributeString": "src = "property%20or%20something" ",
"attributes": [
{
"$class": "org.accordproject.commonmark.Attribute",
"name": "src",
"value": "property or something"
}
],
"content": "",
"closed": true
},
"text": "<custom src="property%20or%20something"/>"
},
{
"$class": "org.accordproject.commonmark.Text",
"text": " property."
}
]
}
]
}
We aren't using Slate in this package, except on one line:
Unless we decide to validate against a Slate schema, I see little benefit of that additional dependency. We could make that call rely on the Slate JSON representation and let users load to Slate from it instead.
This would also let us remove of the slate
and immutable
peer dependencies.
Is your feature request related to a problem? Please describe.
Provide new CiceroMark nodes for variables corresponding to conditional blocks in templates.
CiceroMark variables can be either seen as plain text or wrapped (e.g., <variable id="rate" value="3.5"/>
).
Conditional blocks in CiceroMark can also be wrapped, but cannot be easily distinguished from regular variables.
Conditional variables corresponding to conditional blocks are not reflected in the Slate AST, which means they cannot easily be edited by the UI components.
Describe the solution you'd like
ConditionalVariable
conditional
<if id="varName" value=""/>
Additional context
Support for editing of conditional and list variables in Cicero UI:
accordproject/cicero-ui#233
Is your feature request related to a problem? Please describe.
Because the clauseText
attribute will be removed from the clause nodes in the concerto AST, I cannot easily obtain the full text of a clause without variable syntax from the markdown string for a contract.
Describe the solution you'd like
Method for retrieving non-variable text from a concerto AST clause node. I believe this method would be part of the cicero mark transformer, but not positive.
Additional context
My use case: I have markdown that includes clauses with variable syntax, and I want to get the clauses and their non-variable text. Once the clauseText
attribute is removed from the clause code in the concerto AST, I will need to do this hacky code (which I am trying to avoid):
function getClausesFromMarkdown(markdown) {
const commonMarkTransformer = new CommonMarkTransformer({ tagInfo: true });
const ciceroMarkTransformer = new CiceroMarkTransformer();
let concertoAst = commonMarkTransformer.fromMarkdown(markdown, 'json');
concertoAst = ciceroMarkTransformer.fromCommonMark(concertoAst, 'json');
const clauseNodes = concertoAst.nodes.filter(({ $class }) => $class === 'org.accordproject.ciceromark.Clause');
return clauseNodes.map((node) => {
const {
clauseid, src, clauseText, ...transformedNode
} = node;
return ({
...node,
clauseText: ciceroMarkTransformer.toMarkdown({ ...transformedNode, $class: 'org.accordproject.commonmark.Paragraph' }, { wrapVariables: false })
});
});
}
Link to CiceroMark DOM schema
https://models.accordproject.org/ciceromark/ciceromark.html
is broken
Is your feature request related to a problem? Please describe.
It's a feature request related to a feature. The idea would be to have a deployed Dingus in the style of https://spec.commonmark.org/dingus/ but for CiceroMark.
Describe the solution you'd like
It could be almost exactly like the commonmark dingus but:
It would be useful to be able to create contracts from existing MS Word DOCX files.
https://github.com/mwilliamson/mammoth.js#readme
https://pandoc.org
This should be integrated with #145
The Concerto models for CommonMark and CiceroMark should be published to models.accordproject.org and downloaded by the build scripts.
I'm unclear that this is what should be happening?
markdown-transform/packages/markdown-slate/src/ToSlateVisitor.js
Lines 228 to 241 in 90cf0cf
Users currently have large volumes of existing legal contracts, containing a wide variety of legal clauses. E.g. the contracts may contain 90 day payment terms, acceptance of delivery clauses etc.
It would be very useful to be able to train a model to detect instances of a specific type of clause (say acceptance of delivery) and then to automatically (or with manual guidance) help the user replace the natural language in their contract with an instance of the acceptance of delivery clause, with the correct values extracted from the input contract.
The template detection logic should operate upon the CommonMark DOM (a JSON representation of Markdown formatted text) - replacing paragraph nodes in the DOM with Clause nodes from the CiceroMark DOM.
It would be useful to be able to run a fuzzy match a CommonMark DOM against a set of templates - detecting potential instances of the templates in the CommonMark text (clauses).
Is your feature request related to a problem? Please describe.
Provide new CiceroMark nodes for variables corresponding to list blocks in templates.
CiceroMark variables can be either seen as plain text or wrapped (e.g., <variable id="rate" value="3.5"/>
).
List blocks in CiceroMark are currently not wrapped.
Variables corresponding to list blocks are not reflected in the Slate AST, which means they cannot easily be edited by the UI components.
Describe the solution you'd like
ListVariable
.ulist_variable
and olist_variable
```<list ...> ```
Additional context
Support for editing of conditional and list variables in Cicero UI:
accordproject/cicero-ui#230
The test is currently skipped here:
https://github.com/accordproject/markdown-transform/blob/master/src/CommonMark.test.js#L149
Describe the bug
Using emphasis (e.g., *..*
or **...**
) around inlines or CiceroMark variables results in nodes with null
text in Slate DOM.
This breaks the Slate editor, and the markdown-editor.
To Reproduce
Steps to reproduce the behavior:
Markus parse --sample strongvariable.txt --slate
null
text nodes:...
"nodes": [
{
"object": "text",
"text": "On ",
"marks": []
},
{
"object": "text",
"text": null,
"marks": [
{
"object": "mark",
"type": "italic",
"data": {
}
}
]
}
]
...
Expected behavior
A proper slate node for inline or variables with the corresponding emphasis mark
Describe the bug
Translating from markdown to slate and back sometimes introduces additional new lines.
To Reproduce
For instance on the attached sample.md:
sample.txt
$ cat sample.md
## Fixed rate loan
This is a _fixed interest_ loan to the amount of 100000
at the yearly interest rate of 2.5%
with a loan term of 15,
and monthly payments of {{I'm not sure which amount right now}}
$ markus normalize --sample sample.md --slate
12:34:44 - info:
Fixed rate loan
----
This is a *fixed interest* loan to the amount of 100000
at the yearly interest rate of 2.5%
with a loan term of 15,
and monthly payments of {{I'm not sure which amount right now}}
When saving from slate to markdown and then re-rendering as Slate, multiline block quotes get lost. The first line is preserved, but the subsequent lines fall outside the block quote when we reload.
Describe the bug
Roundtripping text in the contract editor when there are h1 elements with numbers at the beginning will cause the formatting to change.
Regular text
## 1. Heading two
## 2. Heading two again
## 3. Heading two third
Results in (I think):
Regular text
1. Heading two
---
1. Heading two again
---
1. Heading two third
---
With horizontal rules
Expected behavior
Formatting should be kept as the user sees when roundtripping.
Additional context
@Michael-Grover any other details?
Describe the bug
same issue as this accordproject/template-archive#401
in markdown-common
Image support is currently partial. We need all the transforms to support images.
Implement a transformation (similar to the markdown-html HtmlTransformer) that generates a PDF document from a CiceroMark DOM.
Describe the solution you'd like
Implement a visitor using the https://pdfkit.org library, generating paragraphs and formatted text.
Describe alternatives you've considered
Tried to fine a lightweight HTML -> PDF library (pure JS) but come up empty.
Additional context
Something small, fast and lightweight that is 100% JS. A bonus would be the ability to customise look and feel etc.
Describe the bug
The slate transform seems to swallow lists in some cases. Here is a sample test.
update Markdown to Slate seems to lose any structure except for the first paragraph:
bash-3.2$ cat list.md
1. item one
2. item two
- sublist
- sublist
bash-3.2$ markus parse --sample list.md --slate --output data.json
13:16:40 - info: Creating file: data.json
13:16:40 - info:
{
"object": "value",
"document": {
"object": "document",
"data": {
},
"nodes": [
{
"object": "block",
"type": "ol_list",
"data": {
"tight": "true",
"start": "1",
"delimiter": "period"
},
"nodes": [
{
"object": "block",
"type": "list_item",
"data": {
},
"nodes": [
{
"object": "text",
"text": "item one",
"marks": []
}
]
},
{
"object": "block",
"type": "list_item",
"data": {
},
"nodes": [
{
"object": "text",
"text": "item two",
"marks": []
}
]
}
]
}
]
}
}
Which means normalization returns only the top level list:
bash-3.2$ markus draft --data data.json --slate
13:18:14 - info:
1. item one
2. item two
bash-3.2$ markus normalize --sample list.md --slate
13:18:31 - info:
1. item one
2. item two
This is true of anything which isn't pure text from a single paragraph (breaks, nested lists, multiple chunks of text, etc.)
Describe the bug
Nested lists are drafted with an extra new line, which means tight lists become non-tight.
Here is an example:
bash-3.2$ markus --version
0.7.3
bash-3.2$ cat list.md
1. item one
2. item two
- sublist
- sublist
bash-3.2$ markus normalize --sample list.md --output list2.md
13:27:42 - info: Creating file: list2.md
13:27:42 - info:
1. item one
2. item two
- sublist
- sublist
bash-3.2$ markus parse --sample list.md
13:27:51 - info:
{
"$class": "org.accordproject.commonmark.Document",
"xmlns": "http://commonmark.org/xml/1.0",
"nodes": [
{
"$class": "org.accordproject.commonmark.List",
"type": "ordered",
"start": "1",
"tight": "true", // HERE
"delimiter": "period",
"nodes": [
...
bash-3.2$ markus parse --sample list2.md
13:27:54 - info:
{
"$class": "org.accordproject.commonmark.Document",
"xmlns": "http://commonmark.org/xml/1.0",
"nodes": [
{
"$class": "org.accordproject.commonmark.List",
"type": "ordered",
"start": "1",
"tight": "false", // HERE
"delimiter": "period",
"nodes": [
...
bash-3.2$
Describe the bug
In some cases, headings following certain kinds of blocks are not being rountripped to markdown properly.
bash-3.2$ cat sample.md
# Heading One
This is text. This is *italic* text. This is **bold** text. This is a [link](https://clause.io). This is \`inline code\`.
This is ***bold and italic*** text
> This is a quote.
## Heading Two
This is more text.
Ordered lists:
1. one
1. two
1. three
Or:
* apples
* pears
* peaches
### Sub heading
Video:
<video/>
Another video:
<video src="https://www.youtube.com/embed/cmmq-JBMbbQ"/>
bash-3.2$ markus parse --sample sample.md --roundtrip
13:36:50 - info:
Heading One
====
This is text. This is *italic* text. This is **bold** text. This is a [link](https://clause.io). This is `inline code`.
This is ***bold and italic*** text
> This is a quote.Heading Two
----
This is more text.
Ordered lists:
1. one
2. two
3. three
Or:
- apples
- pears
- peaches### Sub heading
Video:
<video/>
Another video:
<video src="https://www.youtube.com/embed/cmmq-JBMbbQ"/>
Describe the bug
A test in markdown-editor
is failing around the way a link is round-tripped.
FAIL src/SlateAsInputEditor/index.test.js
● SlateAsInputEditor component › successful roundtrip
expect(received).toEqual(expected) // deep equality
- Expected
+ Received
@@ -1,8 +1,8 @@
My Heading
- This is text. This is *italic* text. This is **bold** text. This is a [link](https://clause.io). This is `inline code`.
+ This is text. This is *italic* text. This is **bold** text. This is a [link](https://clause.io ""). This is `inline code`.
This stems from this code, where the title
is set to ""
if null.
Expected behavior
Probably need to skip this behavior entirely.
Additional context
This commit
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.