Code Monkey home page Code Monkey logo

Comments (8)

thepassle avatar thepassle commented on May 27, 2024 1

no

from custom-elements-manifest.

bennypowers avatar bennypowers commented on May 27, 2024 1

yeah sounds like a good feature, please open a pr

from custom-elements-manifest.

thepassle avatar thepassle commented on May 27, 2024

Currently to-markdown doesnt support this, no. It is something we've considered adding before, but we havent got there yet.

What you can do is create a custom plugin, modify/filter the customElementsManifest object to filter out what you want/dont want, and then pass it to customElementsManifestToMarkdown. e.g.:

import { customElementsManifestToMarkdown } from '@custom-elements-manifest/to-markdown';

export function markdown() {
  return {
    name: 'markdown',
    packageLinkPhase({customElementsManifest}) {
      // mutate the cem
      customElementsManifest?.modules?.forEach(mod => {
        mod.declarations = mod?.declarations?.filter(({kind}) => kind === 'class');
      });

      // pass it to markdown
      const md = customElementsManifestToMarkdown(customElementsManifest);

      // write to file somehow
    }
  }
}

I would be down to help if i can, but i'm not that familiar with ASTs and such.

I do agree that the functional approach and all the AST-y stuff isn't really inviting or welcoming for contributions, which is a bit of a shame..

from custom-elements-manifest.

michaelwarren1106 avatar michaelwarren1106 commented on May 27, 2024

I started working on a PR, relevant code starts here:
https://github.com/michaelwarren1106/custom-elements-manifest/blob/master/packages/to-markdown/index.js#L109

but your comment about the plugin makes me think that I might need to change approach a bit? would you prefer I open a WIP PR for feedback, or are my local repo changes good enough for you to get an idea of where i am headed?

I went down the road of having a config object that has booleans for each section/type of info that can be removed, so that, when false the section isnt rendered. The only struggle Im having right now is telling the difference between the "main class" and super classes, because currently the manifest schema doesnt seem to mark them differently. I have an option currently to remove superClass sections in case those aren't relevant for whatever reason, but the way the nodes get rendered leaves me a bit confused on the best way to check to see if the node i'm about to render belongs to a super class, since i only have kind === 'class' and the superClass property.

from custom-elements-manifest.

thepassle avatar thepassle commented on May 27, 2024

PR is also fine, in that case i'll defer to @bennypowers

from custom-elements-manifest.

michaelwarren1106 avatar michaelwarren1106 commented on May 27, 2024

question: in the manifest.json will the last kind === 'class' declaration always be the "root class"?

from custom-elements-manifest.

michaelwarren1106 avatar michaelwarren1106 commented on May 27, 2024

will do! i started down one path but i think i have a better idea, so i’m gonna start over.

was struggling with how to remove superclasses but i think i have a config approach that’ll be flexible enough to allow all kinds of final documentation use cases

from custom-elements-manifest.

michaelwarren1106 avatar michaelwarren1106 commented on May 27, 2024

#139

from custom-elements-manifest.

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.