为 API 组件设置了下沉样式
样式适用于元素 [slot="markdown-html"] 属性.
使用量
安装
npm install --save @advanced-rest-client/markdown-styles
在一个LitElement中
import { LitElement, html, css } from 'lit-element';
import markdownStyles from '@advanced-rest-client/markdown-styles/markdown-styles.js';
class MarkdownImpl extends LitElement {
static get styles() {
return [
css`
:host {
...
}`
,
markdownStyles
],
}
render() {
return html`
<marked-element markdown="....">
<div slot="markdown-html"></div>
</marked-element>`;
}
}
在多聚体3元素中
注意,多聚体风格被腐烂并会被去除.
import {PolymerElement, html} from '@polymer/polymer';
import '@advanced-rest-client/markdown-styles/markdown-styles-polymer.js';
class SampleElement extends PolymerElement {
static get template() {
return html`
<style include="markdown-styles"></style>
<marked-element markdown="...">
<div slot="markdown-html"></div>
</marked-element>
`;
}
}
customElements.define('sample-element', SampleElement);
注意,该元素不包括Polymer库.
发展
git clone https://github.com/advanced-rest-client/markdown-styles
cd markdown-styles
npm install