markup icon indicating copy to clipboard operation
markup copied to clipboard

Reopen issue 346 - Include file-content as part of markdown

Open mcarans opened this issue 8 years ago • 52 comments

Please reopen https://github.com/github/markup/issues/346 - just look at the comments to see the support for this feature

mcarans avatar Feb 05 '18 08:02 mcarans

+1

pgallir avatar Feb 05 '18 08:02 pgallir

+1

eavalenzuela avatar Feb 05 '18 08:02 eavalenzuela

+1

user1095108 avatar Feb 05 '18 10:02 user1095108

Subscribe works better than +1 !!! +1

Artistan avatar Feb 05 '18 14:02 Artistan

+1

brry avatar Feb 06 '18 07:02 brry

+1

BenjaBobs avatar Feb 08 '18 10:02 BenjaBobs

+1

briankfitzwater avatar Feb 08 '18 13:02 briankfitzwater

+1

lucasrodes avatar Feb 10 '18 14:02 lucasrodes

I have been working (in a private repo) on a Ruby class, MarkdownHelper, whose first method is include(template_file_path, markdown_file_path). I had intended to make this public, and to put it onto Rubygems.org.

I've seen in (much) earlier issues that GitHub has security concerns. Should I share their concern, and not go public?

BurdetteLamar avatar Feb 12 '18 14:02 BurdetteLamar

Fwiw, I have made public my GitHub repository MarkdownHelper.

The first feature is file inclusion for GitHub markdown, supporting included text as:

  • Highlighted code block.
  • Plain code block.
  • Verbatim text.

BurdetteLamar avatar Feb 15 '18 15:02 BurdetteLamar

I wouldn't even mind if it were as simple as including an entire file inline. My use case is to be able to display a mermaid diagram tracked in its own .md document across multiple documents.

0Grit avatar Feb 16 '18 21:02 0Grit

Then the verbatim inclusion might be helpful to you?

BurdetteLamar avatar Feb 16 '18 21:02 BurdetteLamar

+1

baukeposthuma avatar Feb 19 '18 22:02 baukeposthuma

Would be awesome to include .js files in markdown documentation

baukeposthuma avatar Feb 19 '18 22:02 baukeposthuma

I've put up a markdown helper with file inclusion on RubyGems:

https://rubygems.org/gems/markdown_helper

BurdetteLamar avatar Feb 21 '18 18:02 BurdetteLamar

@BurdetteLamar I am not clear what your markdown helper does exactly. What do I add to my README.md or README.rst on Github to use your markdown helper to include a file within it?

mcarans avatar Feb 23 '18 16:02 mcarans

Specify each file inclusion via an include pragma, which has the form:

  • @[format](relative_file_path)

where:

  • format (in square brackets) is one of the following:
    • Highlighting mode such as [ruby], to include a highlighted code block. This can be any Ace mode mentioned in GitHub Languages.
    • [:code_block], to include a plain code block.
    • [:verbatim], to include text verbatim (to be rendered as markdown).
  • relative_file_path (in parentheses) points to the file to be included.

[The formatting of my doc is correct on GitHub, but gets mangled on RubyDoc.info. In answering you, I may have discovered a fix.! Will work on it.]

BurdetteLamar avatar Feb 23 '18 16:02 BurdetteLamar

@BurdetteLamar Do I need to add markdown_helper-0.1.5.gem in the root of my Github repo for it to work? If not, where should it go?

mcarans avatar Feb 23 '18 16:02 mcarans

@mcarans First, thanks for the earlier nudge. Got my doc fixed so it's right both on GitHub and RubyGems.

Second, let's take this offline, say, to email at [email protected]. Or Skype at burdette.lamar.

BurdetteLamar avatar Feb 23 '18 17:02 BurdetteLamar

I've seen over at GH that @mcarans often(?) codes in Python.

My method MarkdownHelper#include is not all that much code, so it wouldn't be hard to port it from Ruby to Python.

But that idea brings me back to something I'd thought before: Maybe we should have an agreed-upon specification for include files (i.e., specify the format for the include pragma). Then implementations that honor that spec would be able to process anyone's input.

Alternatively, there could be just two "universal" implementations, one (say, sh) that works on Linux, and one (say, Powershell) that works on Windows.

Thoughts?

[I know this is a bit off-topic for GH, but I don't know where else to go with this idea. Suggestions welcome.]

BurdetteLamar avatar Feb 23 '18 19:02 BurdetteLamar