Code Monkey home page Code Monkey logo

Comments (5)

wooorm avatar wooorm commented on May 30, 2024

Hi @ivan-kleshnin! Sorry this went unanswered for a while!

I think that’s a pretty good idea, but I feel it’s better suited as a standalone plugin. Maybe even for rehype itself? Feel free to chat about that on Gitter, if you’re interested in building it!

Cheers,
Titus

from remark-highlight.js.

ivan-kleshnin avatar ivan-kleshnin commented on May 30, 2024

Hi, Titus. No problem. I plan to invest some time in rehype ecosystem in the future because of my main project (which is turning into something quite markdown-based). You've made a lot of interesting thematic libraries – I should admit... So I'll definitely consider to create this plugin.

Cheers!

from remark-highlight.js.

wooorm avatar wooorm commented on May 30, 2024

Thanks for the kind words! I hope you’ll try it out, let me know if I can help!

from remark-highlight.js.

babakfp avatar babakfp commented on May 30, 2024

Hi

I was looking to impement the same feature so I wrote this:
https://github.com/babakfp/remark-inline-code-language

But, it seems like I should've made the plugin for rehype because I don't get back the lang property in this example:

import { unified } from "unified"
import { visit } from "unist-util-visit"
import remarkParse from "remark-parse"
import remarkInlineCodeLanguage from "../../remark-inline-code-language/dist/index.js"
import remarkRehype from "remark-rehype"
import rehypeStringify from "rehype-stringify"

const file = await unified()
	.use(remarkParse)
	.use(remarkInlineCodeLanguage)
	.use(remarkRehype)
	.use(() => {
		return (tree, file) => {
				visit(tree, "element", function visitor(node) {
				console.log(JSON.stringify(node, null, 4))
			})
		}
	})
	.use(rehypeStringify)
	.process("`_js console.log()`")

Is that correct? Do I need to build it for rehype or what can I do?

Thanks

@wooorm

from remark-highlight.js.

ChristianMurphy avatar ChristianMurphy commented on May 30, 2024

Welcome @babakfp!
That is not what this thread is about, it is about a different, plain HTML syntax.
This tread is also over 6 years old, the project has changed and evolved over the years.
I'd recommend opening a thread in discussions (https://github.com/orgs/remarkjs/discussions) and offering a bit more context on your goal.

The original suggestion that rehype would likely be involve may still holds true #26 (comment)
But more context can help clarify.

I'm going to lock this thread as it's outdated, and this new conversation is unrelated to the original thread.
But happy to continue the conversation in discussions (https://github.com/orgs/remarkjs/discussions)

from remark-highlight.js.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.