P
@magic-modules/p
this is the @magic-modules P component.
receives string, array of strings or array of arrays of strings and wraps them in one or more p elements.
installation
npm install --save-exact @magic-modules/p
usage
markdown:
<Picture name="image"></Picture>
javascript:
P('Text to Wrap')
both examples above output:
<p class="P">Text to wrap</p>
example:
Text to wrap
arrays
Array arguments get wrapped in <p> tags.
P([
'first paragraph.',
'second paragraph.',
'third paragraph.',
])
renders:
<div class="P">
<p>first paragraph</p>
<p>second paragraph</p>
<p>third paragraph</p>
</div>
example:
first paragraph
second paragraph
third paragraph
deep arrays
Array arguments get wrapped in <p> tags shallowly with a depth of 1. nested arrays get wrapped into one p.
P([
[
'nested array with a ',
Link({ to: '/' }, 'link'),
' embedded in the text',
],
'second paragraph.',
])
renders:
<div class="P">
<p>nested array with a <a href="/p/">link</a> embedded in the text</p>
<p>second paragraph.</p>
</div>
example:
nested array with a link embedded in the text
second paragraph.
source
the source for this page is in the example directory and gets built and published to github using @magic