GithubHelp home page GithubHelp logo

Comments (7)

DianaLease avatar DianaLease commented on July 25, 2024 1

@DianaLease Can we consider this issue resolved?

Yes, works for me!

from markdown-transform.

jeromesimeon avatar jeromesimeon commented on July 25, 2024

@DianaLease I don't think I was thinking straight last night, and after going down a rabbit's hole for a bit, I realised there is an easy way to get the clause text already:

Instead of going directly from CiceroMark DOM to CommonMark text with:

ciceroMarkTransformer.toMarkdown(clauseNode)

Instead generate the CommonMark DOM then get the text:

ciceroMarkTransformer.toCommonMark(clauseNode).text;

You should be able to test that. Let me know if it works, and I will then remove the clauseText field from the Clause node.

from markdown-transform.

jeromesimeon avatar jeromesimeon commented on July 25, 2024

@DianaLease I don't think I was thinking straight last night, and after going down a rabbit's hole for a bit, I realised there is an easy way to get the clause text already:

Instead of going directly from CiceroMark DOM to CommonMark text with:

ciceroMarkTransformer.toMarkdown(clauseNode)

Instead generate the CommonMark DOM then get the text:

ciceroMarkTransformer.toCommonMark(clauseNode).text;

You should be able to test that. Let me know if it works, and I will then remove the clauseText field from the Clause node.

from markdown-transform.

DianaLease avatar DianaLease commented on July 25, 2024

Recapping an outside convo here -
The above proposed solution produces the text but with the variable syntax still present. It would be useful to have a way to pass { wrapVariables: false } as an argument to the toCommonMark method, similar to how it can currently be passed to the toMarkdown method.
Scratch that. I was passing it as the second argument, but it works when passed as the third argument.

from markdown-transform.

jeromesimeon avatar jeromesimeon commented on July 25, 2024

@DianaLease I don't think I was thinking straight last night, and after going down a rabbit's hole for a bit, I realised there is an easy way to get the clause text already:

Instead of going directly from CiceroMark DOM to CommonMark text with:

ciceroMarkTransformer.toMarkdown(clauseNode)

Instead generate the CommonMark DOM then get the text:

ciceroMarkTransformer.toCommonMark(clauseNode).text;

You should be able to test that. Let me know if it works, and I will then remove the clauseText field from the Clause node.

Adding the call to clarify what to do to get the text without variable tags:

ciceroMarkTransformer.toCommonMark(clauseNode, 'json', { wrapVariables: false }).text;

from markdown-transform.

jeromesimeon avatar jeromesimeon commented on July 25, 2024

I have added a method to encapsulate the clause text extraction:

ciceroMarkTransformer.getClauseText(clauseNode, { wrapVariables: BOOLEAN })

This will:

  1. regenerate the clause text (with or without wrapped variables)
  2. remove single trailing new line due to code blocks encodings in CommonMark
  3. raise an exception for non-Clause nodes

from markdown-transform.

jeromesimeon avatar jeromesimeon commented on July 25, 2024

clauseText field from CiceroMark has been removed. Will ship with release 0.6.0

@DianaLease Can we consider this issue resolved?

from markdown-transform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.