Comments (18)
Ok, here is a new branch.
See fde4eca, Should works has expected. If everything is fine, I will consider to merge it. Still need more tests. I think that it will be disabled by default and should be enabled manually.
from remark-attr.
@arobase-che Looks good. Would be a nice addition if merged. Along similar lines, how about supporting ul
and ol
as well? This
- li1
- li2
- li3
{.some .classes}
would give
<ul class="some classes">
<li>li 1</li>
<li>li 2</li>
<li>li 3</li>
<ul>
from remark-attr.
Not sure it should be considered as an issue.
paragraph
are not in the list of remarkAttr.SUPPORTED_ELEMENTS
.
Because paragraphs are simply not supported. ^^
from remark-attr.
As in there's no significant use cases for paragraph?
ie:
This is some content in paragraph that displays in larger font size.{.larger}
Is there any possible way I can add support to paragraph by customising this plugin locally?
from remark-attr.
I will take some times to study it this WE but can't guaranty anything.
from remark-attr.
Alright. Thank you @arobase-che
from remark-attr.
Ok. I used to have studied that case.
Paragraph are a little special. They can't be implement the way other elements are.
Because the attributes part {attr key=val #id .class}
will be inside the paragraph unlike link/image, strong, ...
That doesn't mean it should not been supported but it a little more complicated. So I didn't close that issue.
from remark-attr.
Hi @arobase-che , thanks for your kind attention.
I have looked around and couldn't find a solution to this issue; and have moved on to using custom react components to deal with that.
Thanks for the effort though.
from remark-attr.
@arobase-che before I try myself: Could I just fork and add 'p'
to supportedElements
and then get it working by putting the attr not besides (so inside the <p />
) but on the next line like this:
This is a nice little paragraph.
{.with .some .extra .classes}
Should yield <p class='with some extra classes'>...
Could this work?
from remark-attr.
Follow-up: it can't work because there is a line break in between, right?
from remark-attr.
from remark-attr.
Previously when using Jekyll with GFM, the markdown format:
This is a paragraph.{:.classname}
{:.classname}
This is a paragraph.
Would both be working as intended.
Recently we have switched to Gatsby, trying to avoid wrapping custom components just to style texts.
Thus we tried remark-attr; so far we couldn't get it to work. (Including adding p to the supportedElements).
from remark-attr.
So, it looks like you really need it.
Here is just a PoC. The easy one, I talked about.
This is a nice little paragraph.
{.with .some .extra .classes}
Works on the paragraph branch. See : b15b449
I'm not sure it should be merged. Maybe we should code something a little more complex but that can deal with that case:
This is a nice little paragraph.
{.with .some .extra .classes}
PS: Everything is about syntax we want to support. I don't want to chose for others.
from remark-attr.
@arobase-che's first example above could work in the wild. However it's a bit error prone and not intuitive for eg non-coders. 2nd example is intuitive and it's also good because the writer is forced to select an entire p
that he can't span and put into some other div
(compared to a same line aproach).
from remark-attr.
Another reason against the first example: In some systems I split the markdown by paragraphs into an array to make the conversion to JSX only for that lines and not for the entire document (to make everything faster, basically an JIT-conversion of needed paragraphs).
from remark-attr.
I'm against too. I just don't have time to support the second example.
from remark-attr.
Is this still in the works?
from remark-attr.
I tested kouhei-fuji's branch and it does work fine for me, also after merging with master. Is there anything anything I could do to help in order to merge this?
from remark-attr.
Related Issues (18)
- Fenced code? HOT 13
- Support attributes in the same line as an ATX heading? HOT 5
- Support spans with attributes? HOT 1
- Support for custom data attributes HOT 5
- Stop looking for attrs in the fenced code HOT 3
- Support for linkReference HOT 4
- Are image elements supported? HOT 8
- Support angle-bracket links HOT 2
- Remove undefined values from hProperties HOT 1
- Tags not added on images with Docusaurus HOT 4
- remark@next (13) HOT 10
- ATX-style cannot specify attributes if the header has inline syntax HOT 1
- There is a bug HOT 4
- 'Missing parser to attach `remark-attr` [link] (to) HOT 3
- key/class/id support HOT 2
- classes? HOT 1
- [email protected] npm package missing dist/index.js file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
/ paragraph?
from remark-attr.