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

brightml

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brightml

Smart utility rendering markdown-ready HTML

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

Brightml

Smart utility rendering markdown-ready HTML.

Install

$ npm install brightml

Use

Brightml is promised-based.

var Brightml = require('brightml');
var converter = new Brightml('index.html');

converter.render()
.then(function (cleanHTML) {
    // Use your cleanHTML as intended
});

What gets done

Brightml performs the following in order.

Clean elements
  • Remove empty tags.
  • Remove forbidden HTML tags and place their HTML content in a <p> instead.
  • Remove forbidden HTML attributes.
  • Remove unallowed links schema in HTML attributes.

This operation uses the rules.js file to determine which tags/attributes/schemes are allowed.

Set anchors id

Try to set <a> tags id attribute on their direct parent if possible.

Move local references

For each <a> tag's href attribute local link, move the referenced HTML element before the next <h1> tag. This feature is used to prevent breaking of local links and keep them in sight.

Remove nested <table> tags

Replace nested <table> tags by a warning message followed by their content in a simple <td> tag.

Evenly format <table> elements

Ensure every <table> elements look the same.

Used schema :

<!-- Move caption before <table> if any -->
<caption></caption>

<table>
  <!-- Ensure the first row contains <th> tags in a <thead> element -->
  <thead>
    <tr>
      <th>Title 1</th>
      <th>Title 2</th>
    </tr>
  </thead>
  <!-- Ensure all remaining rows are inside a <tbody> element -->
  <tbody>
    <tr>
      <td>Row 1 - Data 1</td>
      <td>Row 1 - Data 2</td>
    </tr>
    <tr>
      <td>Row 2 - Data 1</td>
      <td>Row 2 - Data 2</td>
    </tr>
  </tbody>
</table>
Clean table cells

Ensure every <th> and <td> tags don't contain a <p> tag to prevent line breaking.

FAQs

Package last updated on 05 Jan 2016

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