Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ulu/sassdoc-to-markdown

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ulu/sassdoc-to-markdown

A flexible SCSS documentation tool that generates clean, customizable Markdown from your Sass stylesheets. It leverages SassDoc for data extraction and offers various configuration options to tailor the output to your specific needs

  • 0.0.13
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
0
Weekly downloads
 
Created
Source

Sassdoc To Markdown

A flexible SCSS documentation tool that generates clean, customizable Markdown from your Sass stylesheets. It leverages SassDoc for data extraction and offers various configuration options to tailor the output to your specific needs.

  • Compiled Sass examples (Dart Sass)
  • Preview (output) HTML examples
  • Content blocks between documented items (ie. generic content not tied to a specific annotation)
  • Compiled examples can be configured to use your own implementation, see options (ie. if using node-sass for example)
  • Custom group display names by adding dash ie /// @group util - Shared Utilities
  • Group descriptions pulled from lines after group definition (you can also use content blocks to describe groups)
  • Ability to override all annotation and page templates and add your own

Table of Contents

  • Examples
  • Configuration
  • Changes

Examples

Example of Using this Library

import { resolve, dirname } from "path";
import { fileURLToPath } from "url";
import { outputPages } from "@ulu/sassdoc-to-markdown";

const __dirname = dirname(fileURLToPath(import.meta.url));

(async () => {
  await outputPages({
    dist: resolve(__dirname, "docs/"),
    dir: resolve(__dirname, "src/sass/"),
    pathBase: "/sass/"
  });
})();

Compiled Sassdoc Example

/// In addition to the code block example this example will show the compiled result. Note the  {compile} modifier on the example. It also uses the compiler annotation to load the module for the compiled example. Content in the compiler annotation are prepended to the compiled code for the item or group if at file-level)
/// @compiler
///   @use "_this-file" as examples;
/// @example scss {compile} This example will be compiled
///   @include examples.print-color(red);

@mixin  print-color($value) {
  .test {
    color: $value;
  }
}

Preview HTML Example

/// In addition to the html example this will also be previewed in an iframe. Note the {preview} modifier. Settings are available to add stylesheet and javascript to iframe. Iframe used for isolation from docs styles. 
/// @example html {preview} This example will be previewed
///   <span class="test">This is a test</span>

@mixin  some-mixin($value) {
  .test {
    color: red;
  }
}

Configuration

The following options can be passed to configure this generator. Also you can see the full defaults at /lib/defaults.js.

NameTypeDefault ValueDescription
diststring""The directory to output documentation pages
dirstring""The directory that sassdocs will parse and make pages from
debugbooleanfalsePlugin development flag (output logs, etc)
debugToDirstringnullPrint out plugin/sassdoc data (used for developing plugin)
pathBasestring"/sass/"Path to prefix to all paths generated for sassdocs
byTypebooleantrueWhether or not the documented items should be organized by type (variable, mixin, etc) or should display in the order they were parsed
sassdocOptionsobject{ verbose: true }Sassdoc library options
contentEnabledbooleantrueInclude comment blocks that are between sassdoc items
contentInlinebooleantrueExtra content should all be displayed above items (ie. variables, mixins, etc) even if it is in between documented items
previewEnabledbooleantrueOutput preview of html code from an example
previewTemplatefunction(code, ctx) => <div>\n${ code }\n</div>Template to use for html previews
previewTitlestring"Preview"Title for preview
undefinedGroupNamestring"None"Name for undefined groups
annotationsstring[]["name", "description", ...]Controls order and which annotations are printed
showSourceCodestring[]["placeholder", "css", ...]The documentation types that should display source code
customAnnotationsstring[][](empty)
pageTemplatesobject{}(empty)
annotationTemplatesobject{}(empty)
pageTitleFormatterfunctiontitleCaseCallback function used to format the page title (from the group name)
itemTitlefunction(data) => ...Function to format item titles
compilerfunctioncompileSet custom compiler for sass
compilerOptionsobject{ additionalData: null, ... }Options passed to sass for compiled sass examples
sortfunction(a,b) => ...Callback used to sort (array method) the pages before adding to Vuepress
outputFilesbooleantrueCan be used to disable output, ie. using build end to do something manually
outputTemplatefunction({ frontmatter, content }) => ...Template for markdown files
buildEndfunction(data) => ...Callback when page's have been generated/sorted before output
resolveLinkfunction(item, options) => ...Method to override how links to items are created

Changes

Change Log

Keywords

FAQs

Package last updated on 21 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc