Code Monkey home page Code Monkey logo

Comments (9)

wooorm avatar wooorm commented on May 20, 2024 1

Awesome, glad it worked!

I looked through the readmes and here are some suggestions, If you’re interested:

  • The remark-definition-list usage example uses ./index, but should probably import the package name?
  • For remark plugins, I recommend using a default export for the plugin. This means they can be used by the engine (remark-cli), such as with remark input.md --use remark-definition-list --output output.md (only with a default can the engine/cli “find” the plugin).
    All other plugins also use a default export, so it’ll help users because there is a single API
    You can export the same value as both a named export and a default export btw, so it can be a minor release!
  • You can add the plugin to the List of plugins in remark’s readme https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins
  • Same for the extension here, maybe a new “Community extensions” heading, with this extension, under the current list of extensions? https://github.com/micromark/micromark#list-of-extensions
  • There’s a typo in the micromark extension readme: Definitio instead of Definition. Also develepment -> development!

👋

from micromark.

wataru-chocola avatar wataru-chocola commented on May 20, 2024 1

@wooorm

I published new version including your suggestions, bug fix, some improvement.
Can I ask you to add my plugin and extension to remark / micromark readme?

from micromark.

wooorm avatar wooorm commented on May 20, 2024 1

Done!

from micromark.

wooorm avatar wooorm commented on May 20, 2024

Maybe I can help better if you share what you want to do?
Perhaps it’s possible to not use containers? Containers are quite complex.
And indeed, resolve changes the events.

from micromark.

wataru-chocola avatar wataru-chocola commented on May 20, 2024

@wooorm Thank you for your reply.

I've been trying to implement a micromark extension for definition list in this spec.
For example, following markdown

Apple
:   Pomaceous fruit of plants of the genus Malus in 
    the family Rosaceae.

Orange
:   The fruit of an evergreen tree of the genus Citrus.

would makes the following HTML.

<dl>
<dt>Apple</dt>
<dd>Pomaceous fruit of plants of the genus Malus in 
the family Rosaceae.</dd>

<dt>Orange</dt>
<dd>The fruit of an evergreen tree of the genus Citrus.</dd>
</dl>

I read setext-underline.js and list.js and imitated them because their syntaxes look like one which I wanted to handle.
Is there any way to implement this syntax extension without containers?

from micromark.

wooorm avatar wooorm commented on May 20, 2024

If you really want to do this, I think you might be better of looking at footnote definitions for the “container” part, those colons, see: https://github.com/micromark/micromark-extension-footnote/blob/561f958a9bf33a1f3f0d2f61b370199dbff2610b/dev/lib/syntax.js#L45-L49.

But, honestly, I think this is a bad designed syntax extension, that doesn’t match how markdown works otherwise.

Better solutions in my opinion are either directives (Arbitrary extension mechanism in § Extending markdown):

:::definition[Orange]
The fruit of an evergreen tree of the genus Citrus.
:::

:::definition[Apple]
*   Pomaceous fruit of plants of the genus Malus in 
    the family Rosaceae.

*   An American computer company.
:::

:::definition[Term 1, Term 2]
Definition a
:::

Or (ab)using lists (Using and abusing markdown to add new meaning in § Extending markdown):

*   **Orange**

    The fruit of an evergreen tree of the genus Citrus.

*   **Apple**

    *   Pomaceous fruit of plants of the genus Malus in 
        the family Rosaceae.

    *   An American computer company.

*   **Term 1**
    **Term 2**

    Definition a

from micromark.

wataru-chocola avatar wataru-chocola commented on May 20, 2024

@wooorm Thank you, I'll take a look at micromark-extension-footnote.

And indeed, resolve changes the events.

Well, the behavior about effect.check / effect.attempt / resolveTo seems a bit inconsistent for me.

  • effect.attempt (onsuccessfulconstruct) calls addResult which invokes resolveTo to modify events. This is straightfoward.
  • effect.check (onsuccessfulcheck) doesn't do, but if its argument construct calls effect.attempt inside it, it would run resolveTo and modify events consequently.

If this behavior is not a problem, please close this issue.

And thank you for your help!

from micromark.

wataru-chocola avatar wataru-chocola commented on May 20, 2024

Just FYI.

Thanks to your kind help, I've finally published my extension package.

Regards

from micromark.

wooorm avatar wooorm commented on May 20, 2024

Going to close this, as this particular thing is intended. Maybe some docs somewhere might be good, and I’d appreciate a PR for that if you have a suggestion!

from micromark.

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.