Skip to content

Suggestion: Language Spec as markdown #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fdecampredon opened this issue Jul 23, 2014 · 14 comments · Fixed by #749
Closed

Suggestion: Language Spec as markdown #213

fdecampredon opened this issue Jul 23, 2014 · 14 comments · Fixed by #749
Assignees
Labels
Committed The team has roadmapped this issue Suggestion An idea for TypeScript

Comments

@fdecampredon
Copy link

Instead of doc and pdf if language spec was written with markdown (or asciidoc) it could help to follow changes, and perhaps even for pull-request in the future ?

@Bartvds
Copy link

Bartvds commented Jul 23, 2014

+1

There are many people who want this (I had a codeplex ticket for this once).

This guy had enough and made a start on a markdown conversion: https://github.com/teppeis/typescript-spec-md

Also it should be partitioned in chapters instead of one massive blob with a unusable scrollbar, and be online viewable with proper deeplinking.

@vvakame
Copy link
Contributor

vvakame commented Jul 23, 2014

👍

@Diullei
Copy link

Diullei commented Jul 23, 2014

👍 , please!

@teppeis
Copy link

teppeis commented Jul 23, 2014

👍 nice!

This guy had enough and made a start on a markdown conversion: https://github.com/teppeis/typescript-spec-md

Yes, I made it. Official version is much better!

@Bartvds
Copy link

Bartvds commented Jul 23, 2014

@teppeis But it was a good idea! We need something like that as official version that gets updated (and versioned in git).

PDF and Docx are so old world.

@Diullei
Copy link

Diullei commented Jul 23, 2014

I agree with @Bartvds, a PDF or Word document is not practical in this case.

@joewood
Copy link

joewood commented Jul 23, 2014

👍

@johnnyreilly
Copy link

👍 fantastic idea!

@omidkrad
Copy link

Adopt everything "GitHub"

@RyanCavanaugh
Copy link
Member

This was well-received in the design meeting. We're looking into what we would need to do to make it readable/navigable, since a giant webpage would be perhaps unwieldy and probably we don't want to break it into multiple pages (since you often need to search across the whole document).

@RyanCavanaugh
Copy link
Member

Discussed in design meeting. We'd prefer to keep the Word document as the authoritative source as it's easier to do cross-referencing, section renumbering, global find, and navigation than in Markdown.

We'd definitely like to have a Word -> Markdown conversion tool to produce a web-readable and GitHub-diffable version of the spec, even if that tool only works specifically for the spec. Any recommendations?

@RyanCavanaugh RyanCavanaugh added Help Wanted You can do this and removed In Discussion Not yet reached consensus labels Sep 19, 2014
@robertknight
Copy link

Discussed in design meeting. We'd prefer to keep the Word document as the authoritative
source as it's easier to do cross-referencing, section renumbering, global find, and navigation than in Markdown.

LaTeX would give you the combination of these features plus Git-diff friendliness and easy export to PDF or HTML. Unfortunately I appreciate that would require some effort to convert the spec and might be unfamiliar inside Microsoft. pandoc can help with this.

This is a quick attempt at automatic conversion of the existing Word spec to Markdown using pandoc and doctoc : https://gist.github.com/robertknight/c866f6ff71d4e3cedddd .

This was produced as follows:

pandoc --toc --standalone zip/TypeScript\ Language\ Specification.docx -t 'markdown_github+auto_identifiers' -o typescript.md
doctoc typescript.md

The main omission is that code blocks are not formatted as such. I think that could be addressed outside of pandoc by post-processing the output to auto-detect and format code blocks (ie. auto-indent any blocks whose contents are sufficiently TypeScript/JavaScript-like), or possibly in a pandoc extension.

@robertknight
Copy link

Looks like pandoc does support generating code blocks in the output when processing docx input files. The style used for the relevant blocks in Word just needs to be named "SourceCode". For code fragments in a paragraph, the style needs to be named "VerbatimChar". In the current spec .docx it is named "Code".

See https://github.com/jgm/pandoc/blob/master/src/Text/Pandoc/Readers/Docx.hs for details.

@danquirk
Copy link
Member

Good start. I was playing with pandoc myself. Using the commands you used above I get similar results.

Issues I see:

  • Some characters aren't converted correctly. Did you manually fix this? I see smart quotes and some whitespace being turned into gibberish. Fairly simple to find/replace away the mistakes but annoying nonetheless.
  • Grammar fragments in sections are not styled correctly. Unsure of an immediate solution here.
  • Code segments are not colorized for TypeScript. I did a bulk replace of the Code style in Word with SourceCode which works for getting the code into Code Block style in GitHub Flavored Markdown. I was hoping it would emit ``` to format the Fenced Code Blocks so it'd be a simple find/replace to add the correct language formatter.
  • Some tables are poorly formatted (ex 3.7.2.1 Type Parameters)
  • Lost the header numbering (not sure whether this is pandoc or doctoc's fault)

@ahejlsberg ahejlsberg self-assigned this Sep 25, 2014
@RyanCavanaugh RyanCavanaugh added Committed The team has roadmapped this issue and removed Help Wanted You can do this labels Sep 25, 2014
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Committed The team has roadmapped this issue Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.