Coder Social home page Coder Social logo

Comments (6)

ggrossetie avatar ggrossetie commented on June 2, 2024

http://stackoverflow.com/a/12244248

I think we can only support this feature if the document has a TOC 😒

from asciidoc-googledocs-addon.

briandominick avatar briandominick commented on June 2, 2024

That's really interesting... but it's a fine workaround, right? If you have a lot of internal links, you could add a TOC before converting. I would find that useful.

from asciidoc-googledocs-addon.

ggrossetie avatar ggrossetie commented on June 2, 2024

That's really interesting... but it's a fine workaround, right? If you have a lot of internal links, you could add a TOC before converting. I would find that useful.

Yes with this workaround I think it will be possible to resolve "link ids" (ie. #heading=h.cughuow97z4o) to their corresponding headings titles. So I may be able to create proper local xrefs.

However it's not possible to create a Table Of Contents. So basically if a TOC is not already present in the document we can't do nothing.

from asciidoc-googledocs-addon.

briandominick avatar briandominick commented on June 2, 2024

So we can detect the presence of a toc, and we can detect internal
hyperlinks. If a doc has internal links but no toc, we can echo to the ui
that adding a toc will enable those links.

I'm happy to take a swipe at this one if you want. I just haven't looked at
the DOM or seen what we're working with yet, so can't tell if I'll be in
over my head wrestling with this stuff.

On Jul 23, 2016 16:40, "Guillaume Grossetie" [email protected]
wrote:

That's really interesting... but it's a fine workaround, right? If you
have a lot of internal links, you could add a TOC before converting. I
would find that useful.

Yes with this workaround I think it will be possible to resolve "link ids"
(ie. #heading=h.cughuow97z4o) to their corresponding headings titles. So
I may be able to create proper local xrefs.

However it's not possible to create a Table Of Contents. So basically if a
TOC is not already present in the document we can't do nothing.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABNKMXGUbxkihXqXtcRrG8MVv716oHoOks5qYnxagaJpZM4JR-O6
.

from asciidoc-googledocs-addon.

ggrossetie avatar ggrossetie commented on June 2, 2024

I'm happy to take a swipe at this one if you want. I just haven't looked at
the DOM or seen what we're working with yet, so can't tell if I'll be in
over my head wrestling with this stuff.

Sure!
The entry point is the document body : Code.gs#L49

Then we iterate on children : Code.gs#L50

Each child is an Element: https://developers.google.com/apps-script/reference/document/element

An Element can be a TableOfContents: https://developers.google.com/apps-script/reference/document/table-of-contents

The Google Apps Scripts documentation is pretty clear and you should find all the information there. When in doubt you can use a Logger to debug: https://developers.google.com/apps-script/reference/base/logger

Let me know if you need help 😉

from asciidoc-googledocs-addon.

briandominick avatar briandominick commented on June 2, 2024

Very cool; thanks for the cheat sheet.

On Sat, Jul 23, 2016 at 6:21 PM, Guillaume Grossetie <
[email protected]> wrote:

I'm happy to take a swipe at this one if you want. I just haven't looked at
the DOM or seen what we're working with yet, so can't tell if I'll be in
over my head wrestling with this stuff.

Sure!
The entry point is the document body
https://developers.google.com/apps-script/reference/document/document#getBody()
: Code.gs#L49
https://github.com/Mogztter/asciidoc-googledocs-addon/blob/master/app/Code.gs#L49

Then we iterate on children
https://developers.google.com/apps-script/reference/document/body#getChild(Integer)
: Code.gs#L50
https://github.com/Mogztter/asciidoc-googledocs-addon/blob/master/app/Code.gs#L50

Each child is an Element:
https://developers.google.com/apps-script/reference/document/element

An Element can be a TableOfContents:
https://developers.google.com/apps-script/reference/document/table-of-contents

The Google Apps Scripts documentation is pretty clear and you should find
all the information there. When in doubt you can use a Logger to debug:
https://developers.google.com/apps-script/reference/base/logger

Let me know if you need help 😉


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABNKMVRupt9Il7D1VDyXAAs_M3KWoOp1ks5qYpP1gaJpZM4JR-O6
.

from asciidoc-googledocs-addon.

Related Issues (20)

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.